Re: [algogeeks] Sort array with two subparts sorted

2011-04-12 Thread vaibhav agrawal
Maintain two pointers, and swap elements... On Tue, Apr 12, 2011 at 4:42 PM, Akash Agrawal wrote: > This is obvious solution what if u have contant space? > > Regards, > Akash Agrawal > http://tech-queries.blogspot.com/ > > > On Tue, Apr 12, 2011 at 3:48 PM, rajul jain wrote: > >> use merge sort

Re: [algogeeks] Sort array with two subparts sorted

2011-04-12 Thread Akash Agrawal
This is obvious solution what if u have contant space? Regards, Akash Agrawal http://tech-queries.blogspot.com/ On Tue, Apr 12, 2011 at 3:48 PM, rajul jain wrote: > use merge sort > > On Tue, Apr 12, 2011 at 3:07 PM, Akash Agrawal > wrote: > >> Given an array with two subparts sorted. How wil

Re: [algogeeks] Sort array with two subparts sorted

2011-04-12 Thread rajul jain
use merge sort On Tue, Apr 12, 2011 at 3:07 PM, Akash Agrawal wrote: > Given an array with two subparts sorted. How will you make a final sorted > array. > > i/p: 1, 5, 7, 9, 11, 23, 2, 3, 8, 9, 21 > > o/p: > 1, 2, 3, 5, 7, 8, 9, 9, 11, 21, 23 > > > Regards, > Akash Agrawal > http://tech-queries

[algogeeks] Sort array with two subparts sorted

2011-04-12 Thread Akash Agrawal
Given an array with two subparts sorted. How will you make a final sorted array. i/p: 1, 5, 7, 9, 11, 23, 2, 3, 8, 9, 21 o/p: 1, 2, 3, 5, 7, 8, 9, 9, 11, 21, 23 Regards, Akash Agrawal http://tech-queries.blogspot.com/ -- You received this message because you are subscribed to the Google Grou

Re: [algogeeks] sort array

2010-12-15 Thread Prashant Kulkarni
can we use Bitonic Sort algorithm ? -- Prashant Kulkarni On Wed, Dec 15, 2010 at 12:52 PM, divya wrote: > Given an array of size n wherein elements keep on increasing > monotically upto a certain location > after which they keep on decreasing monotically, then again keep on > increasing, the

Re: [algogeeks] sort array

2010-12-15 Thread Soumya Prasad Ukil
First determine the point from which array becomes decreasing. Then In-place merge sort. On 14 December 2010 23:22, divya wrote: > Given an array of size n wherein elements keep on increasing > monotically upto a certain location > after which they keep on decreasing monotically, then again keep

[algogeeks] sort array

2010-12-15 Thread divya
Given an array of size n wherein elements keep on increasing monotically upto a certain location after which they keep on decreasing monotically, then again keep on increasing, then decreasing again and so on. Sort the array in place (ie. using only O(1) extra memory). -- You received this messag