A merge sort will be O(n*log n) and not use the extra memory required
for a heap.
Don

On Mar 23, 3:11 pm, Ashish Goel <ashg...@gmail.com> wrote:
> actually, multimap can be avoided, each element of heap is key,value where
> key is the element and value is address and build heap on key.
> Best Regards
> Ashish Goel
> "Think positive and find fuel in failure"
> +919985813081
> +919966006652
>
>
>
> On Sat, Mar 24, 2012 at 1:40 AM, Ashish Goel <ashg...@gmail.com> wrote:
> > don't know if i am complicating..assumption,
>
> > build a multimap of values and the corresponding node address as well as a
> > heap from the given nodes in first pass.
>
> > now from minheap pick one by one and set the second pointer of previous
> > picked min element to this element using multimap(remove from multimap in
> > parallel while updating the second pointers).
>
> > Best Regards
> > Ashish Goel
> > "Think positive and find fuel in failure"
> > +919985813081
> > +919966006652
>
> > On Sat, Mar 24, 2012 at 12:50 AM, Atul Singh <atulsingh7...@gmail.com>wrote:
>
> >> Given a linked list with each node having two pointers : one pointing to
> >> next node & other to null;
> >> how will u point the second pointer to next larger no. and return the
> >> pointer to smallest node
>
> >> --
> >> ATul Singh | Final Year  | Computer Science & Engineering | NIT
> >> Jalandhar  | 9530739855 |
>
> >> --
> >> 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.- Hide quoted text -
>
> - Show quoted text -

-- 
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