Merging or Merge Sort
Merging or Merge Sort
Example:
Let us consider the elements:
35,50,15,25,80,20,90,45
Let us consider the first element 35 as pivot or i. The last element 45 as j
50 which is greater than pivot taken as i and the 20 smaller than pivot taken as j
Let 25 as pivot. The lesser of 25 that is 15 as j and there is no greater. So bring i after j i > j
so swap pivot and j
After swapping
Algorithm: