Re: [algogeeks] Amazon Interview Question

2012-04-27 Thread Radhakrishnan Venkataramani
of that represents edges of that node. Am I right? On Wed, Apr 25, 2012 at 5:40 PM, Radhakrishnan Venkataramani radhakrishnance...@gmail.com wrote: How will you implement a graph data structure ? Give an linked implementation as we do not know how many nodes will be there and how many edges

[algogeeks] Amazon Interview Question

2012-04-25 Thread Radhakrishnan Venkataramani
How will you implement a graph data structure ? Give an linked implementation as we do not know how many nodes will be there and how many edges will be there. Make a copy of this graph.. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post

Re: [algogeeks] counting inversion pairs using BIT

2012-04-24 Thread Radhakrishnan Venkataramani
It is simple. Initialize BIT[MAXN+1] to zero. 1.Iterate from Right to left 2.For each element array[i] Check how many elements are smaller than array[i]. This can be done by just a simple query(array[i]-1); 3. Update the array[i]th index in BIT by 1. // Simple code snippet. long