CIS 067 Section 1
Assignment 06b2001
Desk Checking a Sorting Algorithm
Here is a summary of what I asked you do to for class on Monday, October 29th. The next exam will be on Monday November 5, one week from the 29th and will cover material from Chapters 8 and 9 in the Friedman/Koffman text.
Reread the material on desk-checking algorithms (see especially the tables on p 202 and p. 235) in the Friedman/Koffman text. Then set up two sheets of paper, each organized pretty much the way p. 235 is laid out. On one sheet you will record your trace of the sort function. On the second sheet, you will record your trace of the find-index-of-smallest-element function each time it is called. Using the data given in class (an array x with 6 elements unsorted), desk check the C++ code for the selection sort algorithm worked out in class last Wednesday. Each time the function find-index-of-smallest-element function is called stop the trace of the sort function and follow the trace of the find-index function. When the find-index function completes execution, then take up the trace of the sort right where it had left off, but with the index of the smallest element returned to the sort. You need not trace the exchange function as I assume you know what it does.
Your array should now be sorted in ascending order.
ALSO:
___________________________________________________________________________