Saravanan Anna's Questions Coll'n-1

21/02/2011 18:10

1. Given an array of integers. Shuffle the elements in a random manner.
 
2. Given a file and a word. Design a neat algorithm to print the line numbers where the word occurs. Discuss all possible solutions.
 
3. Extending the yesterday's prob. Given N number of files and a word. Find all files in which the word occurs.
 Discuss all possible solutions and complexities.
 
4. Hope u know the difference between binary tree- bt and binary search tree- bst.  Given a bt.
 Write an algo to find if it's bst or not.
 
5. Given an integer- not more than 1000. Write a program to find the factorial of this number.
 
6. Given two binary trees. How will you test if they are structurally identical. Write a neat and tight code for this problem.
 
7. Given a very large integer- upto 2000 digits. Design an algorithm to find if this integer is perfect square or not.
 
8. Given a number. Write a program to compute the square root of it. You may use the techniques you've studied in numerical maths.
 
9. Given two integer arrays A and B. How will you find whether array B is d subset of  A.
Think abt all possible solutions and their time and space complexity.
 
10. Given a string. Remove all the duplicates from it in a most effective way. Ex. amazon output : amzon.
 
11. Try to design an efficient data structure to implement t9 search and insert. Good night. :)
 
12. Given an array of integers. find the 2nd largest number in one traversal.
 Ex, 2, 1,8, 3, 0. Here d first largest no is 8. 2nd largest is 3.
 
13. Given an array of numbers. Find the kth smallest number. This one is the generalised version of yesterday's prob.
 
14. Design a stack which will support an extra fun called min to find the min number in the stack in O(1) time. Remember u shouldn't traverse the entire arraGiven a very large sorted array . You don't know the number of elements present in the array. How will you find out if the given number is present in they to find d min, instead u need to think of a way by which you can get min number in order of 1 time.
 
15. Given an integer- not more than 1000 digits. Design a neat logic 2 find d nearest palindrome which s greater than d given no. Ex: for 19 it's 22 and for 1000 it's 1001.