Fall 2001 CSCI 333 Homework 5

This assignment is due Wednesday, 24 October.

Problem 1

Show the comparisions and exchanges made by the bad sorts, selection, insertion, and bubble, on the following input set of six values:

  1. 3
  2. 7
  3. 15
  4. 13
  5. 2
  6. 5

Problem 2

Show how quicksort will partition the following array of nine values into two parts. Show the exchange and comparisions made in the partitioning. You may choose the pivot.

  1. 3
  2. 19
  3. 7
  4. 13
  5. 15
  6. 2
  7. 17
  8. 5
  9. 23

Problem 3

Show how heapsort will sort the following list of six values.

  1. 3
  2. 7
  3. 15
  4. 13
  5. 2
  6. 5