# Sorting algorithms

1. Merge sort algorithm (Divide and Conquer) Solution
2. Quick sort algorithm (Divide and Conquer) Solution
3. Heap sort algorithm Solution

# Binary search tree related questions

1. Check if binary tree is balanced or not Solution
2. Zig Zag order traversal of tree. Solution
3. Prune all nodes of tree which are outside a range min and max. Solution
4. Find least common ancestor. Solution
5. Replace node with sum of children. Solution
6. Convert tree to DLL. Solution
7. Print last K nodes of binary search tree. Solution
8. Find pair of nodes with given sum. Solution
9. Level order traversal of tree. Solution
10.Build tree from given pre-order and inroder traversal. Solution
11. Tree traversals without recursion. Solution
12. Find paths in binary search tree of given sum. Solution
13. Calculate number of trees with N nodes. Solution
14. Print right view of binary search tree. Solution
15. Vertical sum of binary search tree. Solution

# Array related questions

1. Find missing missing number in an array. Solution
2. Find repeated number in an array. Solution
3. Find all duplicate numbers in an array. Solution
4. Find One missing and one repeated number in an array. Solution
5. Smallest missing numbers in sorted array. Solution
6. Find element in first increasing and then decreasing array. Solution
7. Balanced subarray and zero sum sub array Solution
8. Rotate an array. Solution
9. Find element in rotated array. Solution
10.Sum of two numbers in array equal to K. Solution
11.In array of 0 and 1, find first occurrence of 1. Solution
12. Count sort. Solution
13. Find median of two sorted arrays. Solution
14. Find Kth smallest element in two sorted arrays. Solution
15. Find Kth smallest element in an array Solution

# Matrix related questions

1. Traverse a matrix in spiral order. Solution
2.  Make row and column 1 if there is 1 in it. Solution
3. Search an element in matrix of sorted rows and columns. Solution
4. Rotate a matrix by 90 degree. Solution
5. Find maximum sub matrix with all ones. Solution

# Dynamic programming questions

1. Longest increasing subsequence. Solution
2. Longest common subsequence Solution
3. Subset sum problem Solution
4. Largest sum contiguous sub array. Solution
5. Minimum Jumps to reach end Solution
6. Coin change Solution
7. Minimum Number of coins for change. Solution
8. Matrix multiplication Solution
9. Edit distance Solution
10. Longest palindrome substring Solution
11. Longest palindrome subsequence Solution
12. Check if string in interleaved of two strings. Solution

# String related questions

1. Encoding of a string. Solution
2. Removal of duplicate characters. Solution
3. Find first duplicate character. Solution
4. Tokenize a string based on delimiter. Solution
5. Remove a particular combination of characters from string. Solution
6. Reverse words in a string. Solution
7. Check if string is combination of two strings. Solution
8. Break a string in meaningful dictionary words Solution
9. First non repeating character in stream of characters. Solution
10. Check if two strings are anagrams. Solution
11. Check if any anagram of string is palindrome. Solution
12. Print all anagrams together. Solution

1. Find if there is loop in linked list. Solution
3. Merge two linked list. Solution
4. Find Nth node from end. Solution
5. Flatten a generic linked list. Solution
6. Delete a node from linked list. Solution
7. Check if linked list is palindrome. Solution
8. Clone linked list with arbitrary pointer. Solution

# Heaps

1. Merge K sorted arrays in one sorted array. Solution
2. Find K minimum elements in unsorted array. Solution
3. Find median in continuous stream of integers. Solution
4. Sliding window problem. Solution
5. Heaps basics. Solution
6. Find median of running stream of integers. Solution

# Graphs

1.Depth First Search. Solution
3. Topological sorting. Solution
4. Minimum spanning tree: Prim’s algorithm. Solution
5. Minimum spanning tree: Kruskal’s algorithm. Solution
6. Shortest Path algorithm: Dijkstra’s algorithm. Solution
8. Find connected components of graph. Solution
9. Detecting cycle in undirected graph. Solution

# Miscellaneous

1. Convert string to int, int to string. Solution
2. Find the next palindrome number. Solution
3. Print last N lines of file. Solution
4. Convert a string to equivalent number. Solution
5. Eight queen problem. Solution

• rkpawan

Greatly appreciate all the effort that you have put up in maintaining this site. Any plans of increasing the “Interview problems” section by adding more problems under each of the listed category? Also any thoughts of co-hosting code snippets in Java/C# along with C++ code?

• http://algorithmsandme.in/ Jitendra Sangar

Thanks a lot for your appreciation. Yes, this list is dynamic and will be updated. I have started to learn C# and will probably start coding in C#. If you feel that you can contribute with C#, please let me know, we can workout some way.

• rkpawan

Sure, I can help you in porting C++ code to C#. Let me know the github repo(either existing or new) where you want to maintain the source code. I will initiate pull requests containing C# implementation of the codebase.

• http://algorithmsandme.in/ Jitendra Sangar

Cool! That would be a help. Presently I am using gists for code snippets. We can create anew git hub repo and start working. Please mail me on email provided and we can talk further.

• A. Singh

Great effort Jitendra ! Very useful collection of altgorithms. Keep it up !

• Shubham

sir the link is not available for this question under “Array related questions”

“Find element in first increasing and then decreasing array.”

• http://algorithmsandme.in/ Jitendra Sangar

Yes. I still need to write post for that 🙂 If you have some code, you can send me or I can give you author write, you can also write that.

• Shubham Pendharkar

Code for ” Convert a string to equivalent number”

#include
using namespace std;

int main()
{
char arr[10];

int num=0,flag=0;

cout<>arr;

for(int i=0;arr[i]!=”;i++)

{

if(arr[i]’9′) //To check if the input is valid or not.

{

flag=1;

break;

}

int n=arr[i]-‘0’;

num=num*10+n;

}

if(flag)

cout<<"Wrong input" ;

else

cout<<"Number is: "<<num;

}

• http://algorithmsandme.in/ Jitendra Sangar

Thanks Subham for the code. If you want I can give you write access to blog, you can write a post on int to string and string to int conversion.

• Shubham Pendharkar

Yes sir,I would love to do it.

• Hafeez

• Hafeez

• Hafeez
• http://algorithmsandme.com/ Jitendra Sangar

Done. Thank you very much for all your efforts and pointing out missing links!

• http://algorithmsandme.com/ Jitendra Sangar