@Divye:
Awesome solution dude with amortized complexity of O(1)!
The examples made things even clearer :)

On Jun 26, 8:13 am, 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.

Reply via email to