pointer to next smallest will not lead to constant time operation
Best Regards Ashish Goel "Think positive and find fuel in failure" +919985813081 +919966006652 On Tue, Jun 28, 2011 at 3:19 PM, Anurag Sharma <anuragvic...@gmail.com>wrote: > for second problem, you can create a stack of having each element as a node > having the current value as well as pointer to the next smallest value > present below it. This can solve all 3 operations in constant time. > > Thanks, > Anurag > > > > On Tue, Jun 28, 2011 at 3:00 PM, vikas <mehta...@gmail.com> wrote: > >> 1.Given an array of integers and another integer X - create an algorithm >> to determine if the sum of any two integers in the array would result in x >> 2. design a ADT to implement push(), pop() method as stack, and also has a >> getMinElement(). Require that getMinElement() is constant time but >> push()/pop() do not have to be constant time at first. Then for improvement, >> these three methods are all required to be constant time >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Algorithm Geeks" group. >> To view this discussion on the web visit >> https://groups.google.com/d/msg/algogeeks/-/_meOQF9Qu1AJ. >> To post to this group, send email to algogeeks@googlegroups.com. >> To unsubscribe from this group, send email to >> algogeeks+unsubscr...@googlegroups.com. >> For more options, visit this group at >> http://groups.google.com/group/algogeeks?hl=en. >> > > -- > 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+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > -- 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+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.