[algogeeks] Re: Good problem

2009-10-06 Thread MrM
you can arrange them with equal distances ! if n=1 then, it does not matter where you put the point ! if n1 then, put them with distances = (r2i-r1i) / (n-1) ! it means ou put the first point on r1i and the last point on r2i, the remaining point are distributed with equal distances ! On Oct 5,

[algogeeks] Re: random number [a....b]

2009-10-06 Thread Neeraj Singh
@harit random number means its output cant be predicted,it doesnt mean that the probability will be equal for any number of test runs. e.g consider random number between 3-5 for 3 test runs if the first output is 4 second is 3 then to ensure same probability third output must be 5 which makes

[algogeeks] Visibility graphs

2009-10-06 Thread casperpt
I'm trying to wrap my head around this problem. I compute a visibility graph in order for a robot to move around, and an obvious application in this graph is to find a shortest path. Now finding the start and end of this path is not difficult, but to the best of my knowledge the shortest-path

[algogeeks] Design a stack to perform push(), pop() and retrieve minimum in constant time.

2009-10-06 Thread Manisha
I found this question in a interview blog. http://placementsindia.blogspot.com/2007/09/google-top-interview-puzzles.html Question No. 19 My understanding for retrieve minimum in constant time is, we should be able to find the minimum element in stack and to remove (pop) it in constant time.

[algogeeks] Re: Traversing a binary tree from bottom to top

2009-10-06 Thread Manisha
Thanks a Ton everybody! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com To unsubscribe from this group, send email to

[algogeeks] Re: Design a stack to perform push(), pop() and retrieve minimum in constant time.

2009-10-06 Thread sharad kumar
brother try this push(x) { if stack.empty() { stack.push(x); stack.push(x); } else { if x stack.top() { min = stack.top() stack.push(x) stack.push(min) } else {

[algogeeks] Re: Design a stack to perform push(), pop() and retrieve minimum in constant time.

2009-10-06 Thread Ramaswamy R
The basic idea would be to do push / pop the minimum in stack along with the push / pop elements. It is like maintaining a parallel stack of minimums. A naive implementation would involve two stacks. All operations should be O(1) time complexity. On Tue, Oct 6, 2009 at 1:31 PM, Manisha