[algogeeks] Re: absolute minimum difference

2012-07-28 Thread Krishna Kishore
In O(n^2 ) we can do. But in O(n) i don't get any idea. If any one got the idea just explain. On Friday, 27 July 2012 15:35:24 UTC+5:30, Navin Kumar wrote: Given array of integers (0 or +ve or -ve value) find two elements having minimum difference in their absolute values. e.g. Input {10 ,

[algogeeks] Fixing Up The Binary Search Tree

2012-06-27 Thread Krishna Kishore
Suppose a Binary Search Tree which is unbalanced.is given. Write a routine to balance the Binary Search Tree. Send the Root of the BST as an argument to that routine. It has to Return the Root of the Balanced BST. Thanks In Advance. -- You received this message because you are subscribed to

[algogeeks] Double Linked List Represented With Single Linked List

2012-06-20 Thread Krishna Kishore
Explain how to implement doubly linked lists using only one pointer value*np[x *] per item instead of the usual two (next and prev). Assume that all pointer values can be interpreted as k-bit integers, and define* np[x] to be np[x] = next[x] XOR prev[x],* the k-bit “exclusive-or” of next[x] and

Re: [algogeeks] Double Linked List Represented With Single Linked List

2012-06-20 Thread Krishna Kishore
boundary cases, i.e head and tail, though. On Wed, Jun 20, 2012 at 5:16 PM, Krishna Kishore kknarenkris...@gmail.com wrote: Explain how to implement doubly linked lists using only one pointer value * np[x*] per item instead of the usual two (next and prev). Assume that all pointer values

[algogeeks] LEFT MOST set bit in an unsigned integer.

2012-06-14 Thread Krishna Kishore
How to find the LEFT MOST set bit in an unsigned integer. Example: 00*1*0 0001 0100 0010 is a 16-bit unsigned integer. We have to find the left most set bit position (Starting with 0 from right side ) which is 13th position in our example. How to find this. Can any one pls give any suggestions.

[algogeeks] Microsoft Interview Question

2012-06-13 Thread Krishna Kishore
Given a array of integers both positive and negative and you need to shift positive numbers to one side and negative numbers to other side with the order intact. ex. {-1,5,3,-8,4,-6,9} to {-1,-8,-6,5,3,4,9}. This should be done in O(n). -- You received this message because you are subscribed

[algogeeks] Re: Longest Path in A Graph

2012-02-23 Thread Krishna Kishore
Thank You very much friends. I ve read algorithm Topological Sorting. First we have to perform the topological sorting ( in Linear Time ) on the graph. Then we can find which is the Longest Path in that ordering. But it works for only DAG ( Directed Acyclic Graphs ). I ve done it. But after