I believe a merge sort requires O(n) space complexity. Is stack spce counted towards space complexity? If not, I imagine you could write a merge sort recursively, so that the explict space usage has O(1) complexity.
On Jul 2, 2:37 pm, Abhishek Sharma <[email protected]> wrote: > I think its similar to the merge operation which is used in merge sort... > > correct me if I am wrong.. > > Regards, > Abhishek > > On Sat, Jul 3, 2010 at 12:00 AM, ANKUR BHARDWAJ <[email protected]>wrote: > > > > > Given an array of n elements and an integer k where k<n. Elemnts > > {a[0].....a[k] and a[k+1].....a[n] are already sorted. Give an > > algorithm to sort in O(n) time and O(1) space. > > > -- > > You received this message because you are subscribed to the Google Groups > > "Algorithm Geeks" group. > > To post to this group, send email to [email protected]. > > To unsubscribe from this group, send email to > > [email protected]<algogeeks%2bunsubscr...@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 [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
