CS 10, Fall 1997

Lab 7: Advanced Scripting: Sorting


Outline


Assignment for the Next Lab

Finish reading module 4 (p. 158-165). Review any material from module 4 which you are still confused about. Also read the information about functions on the CS 10 web site (follow the "supplemental readings" link)

Homework 3 , part B, due.


Lab 7 Instructions

  1. Open a copy of the "No Account" stack. Examine the "Do it!" script using the debugging tools. How does this script know which field to sort? How does the sort work? What do Swap and FindMin do? How would you modify this script so that the sort would be done in descending order?

  2. We will discuss the sorting algorithm used in the "Do It!" script. There is a Web site which has nice demos of several different sorting algorithms. The URL for this site is:

    http://www.cs.ubc.ca/spider/harrison/Java/sorting-demo.html

    These demos illustrate that some sorting algorithms are much more time-efficient than are others (for example, compare the "selection" and "bubble" sorts with the "quick" and "heap" sorts [note that the "Do It!" script uses the selection sort algorithm]).

  3. Do lab exercise 6 on page 158 and demonstrate your work to one of the instructors.