Sorting Algorithms II Exercises

  < Previous  Next >
  1. Discuss with your neighbor(s) how the following sorting algorithms work:
    1. Heapsort
    2. Mergesort
    3. Quicksort
  2. How are each of the following animations wrong / inaccurate (compared the videos)?
    1. Heapsort
    2. Mergesort
    3. Quicksort
  3. Trace the following algorithms sorting the following array:
    6 4 10 2 8 0
    Write the contents of the array according to each specified criterion. For swaps, put a star above the number(s) that are swapped.
    1. Heapsort (at the end of each iteration of each loop)
    2. Mergesort (at the end of each merge)
    3. Quicksort (after each swap, including swapping the same element in the same place and the swap for the pivot) (choose the pivot as described in the video)
  4. Write down the following properties for the stated sorting algorithms:
      Best-case
      Big-Oh  
      Average-case
      Big-Oh  
      Worst-case
      Big-Oh  
      Stable?     Extra  
      Space  
      Distinguishing  
      Features  
    Heapsort            
    Mergesort            
    Quicksort            
    1. Last Modified: