Create binary search tree using n nodes of K list den do in-order and make a
single list....

On Fri, Sep 17, 2010 at 12:58 PM, vikas kumar <vikas.kumar...@gmail.com>wrote:

> @Bittu
> I am confused about one point.... you need to process atleast n*k
> elements.... so how will you do it in nlogk time. It seems really
> tricky if possible.....it's min time should be O(nk). correct me if I
> am wrong.
>
> On Sep 17, 6:34 am, tkcn <tkcna...@gmail.com> wrote:
> > Use k-way merging +1.
> >
> > 1. Before the merging start, sorting these lists according to the
> > first element of each list.  // O(k log k)
> > 2. So the first element in the first list is the smallest element. Put
> > the smallest into the result array. // O(1)
> > 3. Then, using binary search to find the new position of the first
> > list  // O(k)
> > 4. These lists are still sorted, so the first element in the first
> > list is still smallest. Just repeat the step 2, 3 n times.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algoge...@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com<algogeeks%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>


-- 
Thanks & Regards

Umesh kewat

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algoge...@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