Re: [algogeeks] Merge unsorted arrays

2011-07-16 Thread Ankur Khurana
Use divide and conquer. take 2 array at a time and .so you are merging two array at a time. num_of_list=m; length of list=n; while(num_of_list 1) { while( (num of list where length = length_of_list) 2) { merge two lists of length (length_of_list); } if(num_of_list %2==0) num_of_list/=2; else

Re: [algogeeks] Merge unsorted arrays

2011-07-16 Thread sagar pareek
sort all the arrays first O(nlogn) then use merge sort On Sat, Jul 16, 2011 at 3:43 PM, Ankur Khurana ankur.kkhur...@gmail.comwrote: Use divide and conquer. take 2 array at a time and .so you are merging two array at a time. num_of_list=m; length of list=n; while(num_of_list 1) {

Re: [algogeeks] Merge unsorted arrays

2011-07-16 Thread Ankur Khurana
oops , didnt see the unsorted thing. complexity is mnlog(n) + mn log(m) On Sat, Jul 16, 2011 at 4:23 PM, sagar pareek sagarpar...@gmail.com wrote: sort all the arrays first O(nlogn) then use merge sort On Sat, Jul 16, 2011 at 3:43 PM, Ankur Khurana ankur.kkhur...@gmail.comwrote: Use