Given an array of size n wherein elements keep on increasing
monotonically upto a certain location after which they keep on
decreasing monotonically, then again keep on increasing, then
decreasing again and so on. Sort the array in O(n) and O(1).
or same question can be asked in a different way
Given an array of n elements and an integer k where k
{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.
Read full article from Bitonic Merge | Techblog
No comments:
Post a Comment