1. There is a single Linked List, reverse the list using only one extra pointer..i.e you can create only one extra pointer other than the head.
2. Given an no. find the first palindrome greater than that..in the most efficient way possible . For eg. if given 345 next palindrome would be 353..
3. There are eight atoms at eight corners of the cube , weight of each atom depends upon the neighouring three molecules.. along the three axis... which Data Structures will u use to effectively find the weight atom.
4. Assume a binary tree(not a BST) is represented in an array..starting from index zero... assume the binary tree to be complete ..given a node find the inorder successor in O(1) time...basically what u need to do is find the formula for it ..
5. Given any two node in a graph...find the first k shortest path in the graph...
6. Suppose u have been given a number ....write an algorithm or a code snippet which determines the no. of 1's in that many iteration.. For Eg.. if the no. contians 5 1's than ur algorithm should not iterate more than 5 times.
7. How would you add 1 to a number without using the arithmetic operators .
8. There are two link list...having a common tail...i.e they are in a Y shape...find the point of intersection in O(n) time and constant extra space.
9. There is a cricle in link list....i.e it is of shape P find this point of circle..in the most efficient way ...
10. In a binary tree(not a BST).. find two node such that there sum is X...
Questions updated
ReplyDelete1. There is a single Linked List, reverse the list using only one extra pointer..i.e you can create only one extra pointer other than the head.
2. Given an no. find the first palindrome greater than that..in the most efficient way possible .
For eg. if given 345 next palindrome would be 353..
3. There are eight atoms at eight corners of the cube , weight of each atom depends upon the neighouring three molecules.. along the three axis... which Data Structures will u use to effectively find the weight atom.
4. Assume a binary tree(not a BST) is represented in an array..starting from index zero... assume the binary tree to be complete ..given a node find the inorder successor in O(1) time...basically what u need to do is find the formula for it ..
5. Given any two node in a graph...find the first k shortest path in the graph...
6. Suppose u have been given a number ....write an algorithm or a code snippet which determines the no. of 1's in that many iteration..
For Eg.. if the no. contians 5 1's than ur algorithm should not iterate more than 5 times.
7. How would you add 1 to a number without using the arithmetic operators .
8. There are two link list...having a common tail...i.e they are in a Y shape...find the point of intersection in O(n) time and constant extra space.
9. There is a cricle in link list....i.e it is of shape P find this point of circle..in the most efficient way ...
10. In a binary tree(not a BST).. find two node such that there sum is X...