Chapter 2/3: Homework 2

  1. (10 points) A sorting method is stable if equal elements remain in the same relative order in the sorted sequence as they were in the original. Give counter examples to show that heapsort is not stable regardless of whether an inequality or a strict inequality is used to switch elements around.

    For a review of heapsort, see the text sections 2.4.1 and 2.4.2 or some past notes, or any text you used for your past Data Structures and Algorithms class.

  2. (5 points) Text, page 152, number 3: Is merge sort a stable sorting method?