MERGESORT STUDY GUIDE


Mergesort. Merge left, merge right, merge.

Merge. Understand how to carry out the merge operation. How many compares does it use when comparing two arrays of size N in the best case? In the worst case?

Mergesort order of growth. Understand how to show that the order of growth of the number of compares is N lg N. Understand why the entire algorithm is also order N lg N.

Mergesort compare bounding. Know why the best case is ~ 1/2 N lg N and the worst case is ~ N lg N compares.

Mergesort properties. Mergesort is stable (why?). Mergesort uses N extra memory (why?). Does mergesort do particularly well on already sorted arrays? Partially ordered arrays?

Recommended Problems

C level

  1. Give a worst case and a best case input for mergesort.

B level

  1. Textbook 2.2.22
  2. Textbook 2.2.8
  3. Fall 2015 midterm, #2c

A level

  1. Using the decision tree idea, rederive the proof that all compare-based sorting algorithms must use at least ~ N lg N compares in the worst case. You may assume Stirling's formula.