- Use single array to implement 3 stack.
- Implement stack class. Write push , pop and peek function. Write a function MIN which return minimum value in O(1).
- Implement queue using 2 stacks.
Monday, May 27, 2013
Stack and Queue Algorithm Questions
Sorting and Searching Algorithm Questions
- Given two sorted array A and B. A is large enough to hold B. Merge the arrays in sorted order.
- Write a function which sort the array of string such that 2 anagram are together.
- A array is sorted in increasing order and rotated many times. Find a number N in given array.
- You have 10 GB of file with each line having 1 string.Sort the file.
- Given sorted array of string. The empty string is inserted between each string. Find a given string in array.
- Given a matrix MxN which is sorted by row and column in increasing order. Find given element .
Tree and Graph Algorithm Questions
- Implement a function to check if binary tree is balanced. A balanced tree is whose left and right sub-tree height do not differ more than 1.
- Given a directed graph. Write algo to find route between 2 nodes.
- Given a sorted increasing order arrray. Create binary search tree with minimum height.
- Given a binary tree. Create a link list of all nodes at each depth.
- Write function which checks whether given binary tree is binary search tree.
- Write algo for next node "in order successor" of a given node in binary search tree.
- Write function of find common ancestor of 2 nodes. This may not be BST and avoid using other data structure.
- Given 2 very large binay tree. Find one tree is sub-tree of another at node N. So that if we cut tree at node N then both the tree are identical.
- Given the binary tree. Print all the paths whose sum is equal to gicen value. Path can start and end anywhere.
Subscribe to:
Posts (Atom)