using LL u cant delete in O(1)  ... u have to traverse from head

On Jul 31, 1:47 pm, Shubham Maheshwari <shubham....@gmail.com> wrote:
> use a doubly linked list ... with a field "node *min".
> weneva you insert an element ... check for the value of min at the head ...
> if the new inserted node has less value ... then set the min field to point
> to itself .... else copy the min field of te previous head.
>
> insertion and deletion is easy ... and I hope i dont need to expalin that
> too ...
>
> On Sun, Jul 31, 2011 at 12:27 PM, siva viknesh <sivavikne...@gmail.com>wrote:
>
>
>
>
>
>
>
> > Create a data structure where inserting, deleting and finding the
> > minimum element all have O(1) time.
>
> > --
> > 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.

Reply via email to