This problem can also be done by using Merging function as in the merge
sort.
1. Copy the sorted elements of the first half in one array (arr L) and
second half in another (arr R). Original array N.
2. count vary from 1 to n.

    if (L[i] < R[j] ) { N[count] = L[i], i++}
   else { N[count] = R[j] , j++}
   count++

3. copy the rest of the elements from the remaining (either L or R whichever
is remaining)

Time complexity  O(n)

Plz correct me if I m wrong.

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