1. Show that the running time of the merge-sort algorithm on an n-element sequence is , even when n is not a power of two.

  1. An algorithm that sorts key-value entries by key is said to be straggling if any time two entries and have equal keys, and appears before in the input, then the algorithm places after in the output. Describe a change to the merge-sort algorithm to make it straggling.

  1. Of the possible inputs to a given comparison-based sorting algorithm on a list of elements, what is the absolute maximum number of inputs that could be correctly sorted with just comparisons? Justify your answer.

  1. Suppose you are throwing a fancy dinner party with guests total. When a guest walks through the front door, they check their coat in and continue to the party. However, the coat check mixes up all of the coats during dinner, so that afterward each guest receives a random coat when they prepare to leave. In other words, each guest gets their own coat with probability . What is the expected number of guests who get their correct coat?

  1. For each of the following recurrences, give an expression for the runtime if the recurrence can be solved with the Master Theorem. Otherwise, indicate that the Master Theorem does not apply.