Prelude to the merge sort algorithm

  • Consider the follow sort algorithm:

      Sorting an array a[ ] of n elements:
    
         1. split the array a[ ] into 2 halves:
    
               an array left[ ]  containing a[0] .. a[n/2]
    	   an array right[ ] containing a[n/2 + 1] .. a[n-1]
    
         2. Sort both halves of the arrays (left[ ] and right[ ])
    
         3. Merge the sorted arrays into the final sorted array
      


  • Dictatic note:

    • In this set of slides, I am presenting a simplified merge sort algorithm that uses SelectionSort( ) to sort the array portions

    • It's easier to understand than recursion...