CPSC 220
Fall 2005
HW 5: Mergesort

Consider the code for mergeSort on p. 355-356 of L&C.

  1. Trace this method for data=[5,1,7,3,4,6,2]. Show the following:

  2. In clear, complete sentences, explain the role of each of the following variables. Assume that you are speaking to an intelligent freshman who has a general understanding of the mergesort algorithm but is having trouble understanding the code.
    1. min
    2. max
    3. pivot
    4. index1
    5. left
    6. right
    7. temp