Mergesort Help Center

Learn more

Warning: The hard deadline has passed. You can attempt it, but you will not get credit for it. You are welcome to try it as a learning exercise.

To specify an array or sequence of values in an answer, separate the values in
the sequence by whitespace. For example, if the question asks for the first
ten powers of two (starting at 1), then the following answer is acceptable:

1 2 4 8 16 32 64 128 256 512

If you wish to discuss a particular question and answer in the forums, please
post the entire question and answer, including the seed (which can be used by
the course staff to uniquely identify the question) and the explanation (which
contains the correct answer).

Question 1

(seed = 822234)
Give the array that results immediately after the 7th call (and return)
from merge() when top-down mergesorting the following array of size 12:

65 56 31 83 30 17 99 92 42 29 73 48

Your answer should be a sequence of 12 integers, separated by whitespace.

Question 2

(seed = 604518)
The column on the left contains an input array of 12 strings to be sorted; the column
on the right contains the strings in sorted order; each of the other 4 columns contains the
array at some intermediate step during either top-down or bottom-up mergesort
(with different columns potentially corresponding to different algorithms).

pink drab drab drab iris drab
iris fawn fawn fawn pink fawn
kobi iris iris iris kobi flax
puce kobi kobi kobi puce iris
fawn pink navy pink drab kobi
drab puce pear puce fawn leaf
navy lime pink lime navy lime
pear navy puce navy pear navy
lime pear flax pear flax pear
flax flax leaf flax lime pink
plum leaf lime plum leaf plum
leaf plum plum leaf plum puce
---- ---- ---- ---- ---- ----
0 ? ? ? ? 3


Match up each column with the corresponding mergesorting algorithm from the given list:

0. Original input
1. Top-down Mergesort (standard recursive version)
2. Bottom-up Mergesort (nonrecursive version)
3. Sorted

You should use each choice at least once. Your answer should be a sequence of 6 integers
between 0 and 3 (starting with 0 and ending with 3), separated by whitespace.

Hint: think about algorithm invariants. Do not trace code.

Question 3

(seed = 330693)
Which of the following statements about mergesort are true? Check all that apply. Unless otherwise specified, assume that mergesort refers to the pure recursive (top-down) version of mergesort (with no optimizations), using the merging subroutine described in lecture.
    
You cannot submit your work until you agree to the Honor Code. Thanks!