@DK - your solution works great but my only concern is that for the worst case, insert() is not really O(1). For example, if you have 1000 elements being inserted in ascending order and then 1001'st element is smaller than the first element, the insert() will become O(n).
On Jun 25, 10:13 pm, DK <divyekap...@gmail.com> wrote: > I've solved it for find_min() - the find_max implementations are analogous. > > Example: > i = insert > d = delete > > i 1 - > q - 1 > dq - 1 <-- min value > > i 2 - > q - 1 2 > dq - 1 2 (min value = 1) > > d - > q - 2 > dq - 2 <-- Note: min value changed > > i 0 - > q - 2 0 > dq - 0 <-- Note: min value changed > > Hope this makes things even clearer. :) > As for the "bonus" part. Let me know if you need an example. :) > > -- > DK > > http://twitter.com/divyekapoorhttp://www.divye.in -- 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.