UMBC CMSC201, Computer Science I, Fall 1994
     Sections 0101, 0102 and Honors 
 Tuesday November 22, 1994 
 Assigned Reading: 11.4 - 11.6
 Handouts (available on-line): none
 Topics Covered:
   -  Announcement: Deadline for Project 4 extended to 
      Wednesday, November 30, 1994.
   
-  Reviewed arrays briefly.
   
-  Tested our random number generator 
      (from November 3 Lecture)
      by simulating rolling two six-sided dice 50 times.
      Used arrays in this program
      to help us plot the histograms.
   
-  We examined
    a new version of the sampling
    program that allows us to specify the number of trials.
    Note that as the number of trials increases, the distribution
    of the results of rolling two six-sided dice approaches the
    expected distribution.  Sample runs.
   
-  We discussed what happens when you pass an array as a parameter
    to a function.  The main difference between passing an array to 
    a function and passing a normal variable is that changes made
    to the array by the called function changes the array in the 
    calling function.  We looked at a sample
    program that exploits this behavior. 
    Sample runs.
   
-  We modified our program that counts the occurrence of letters
    in the user's input to report some additional statistics
    (minimum, maximum and average).  The new
    program uses functions that have arrays as parameters.
    Sample runs.
   
-  With arrays, we can also sort a list of integers entered 
    by the user. This program uses
    Selection Sort to put the numbers in increasing order.
    Sample runs.
   
-  With a sorted list, we can find the location of a number
    more efficiently than looking at every entry.  This 
    program uses binary search
    to find the location of a number in a sorted list.  In a list
    of 63 numbers, we need to examine at most 6 entries to find
    the location of any number.  If our array had 250 million
    entries (approximate population of the United States), we would
    only need to examine 38 entries to find the position of any number.
    Sample run.
Last Modified: 
Wed Nov 23 10:36:27 EST 1994
Richard Chang, chang@gl.umbc.edu