NAMES:

LOGINS:

PRECEPT:

COS 226 Exercises on Sorting 2


1. Show how the file P A R T I O N E D H F L is partitioned using Program 7.2. (You should only call partition() once.) Give the contents of the array after each exchange.





















2. [Exercise 7.2, modified] Show how the file 1 0 0 1 1 1 0 0 0 0 0 1 0 1 0 0 is partitioned using Program 7.2. (You should only call partition() once.) Give the contents of the array after each exchange.

Warning: pay special attention to how the algorithm works when a key is equal to the partitioning element.