This assignment is to be done individually, without a partner. You may share ideas with others in the class, but you should turn in your own assignment. Turn in your answers electronically.
Suppose I asked you to code up heapsort. (Too many algorithms, not enough time, sniff...) At any rate, we've got a wonderful implementation of a heap already. I can imagine two different approaches for heapsort:
a. Use the pre-existing heap code. Specifically: make a heap object, then loop over your array of data that you need to sort, and add each item to the heap. Then remove items from the heap, one at a time, filling up the array from the left to the right as you go (since the heap code we implemented is a min-heap).
b. Scrap the existing heap code, and write something similar that performs directly on the array we have.
An argument for the first choice might go something like: "We've got this pre-existing code, we should use it. Leveraging pre-existing code is smart." An argument for the second choice might go something like "We want our heapsort code to be clear and concise, and we're not using it as a general purpose heap. We should write our code to specifically target our purpose. For example, we don't need to be able to add items to the heap once we start removing them." Both of these arguments completely miss the the critical point, however, that indicates what the right choice is. Explain whether choice a or b above is the right one, and explain what the important reason is.