CS 112 - Lab 6
Questions


Provide answers (on this sheet) to the questions below, and hand them to the TAs at the beginning of lab on Friday, March 21.

  1. Suppose your binary tree was given names which were already in, or close to being in alphabetical order. Would your tree structure be an efficient way to insert and lookup these names? Explain.
    
    
    
    
    
    
  2. What is the reason for using macros?
    
    
    
    
    
  3. Draw the binary tree your program would build if the names were given in the following order:
    Gates
    Davis
    Lamb
    Atkins
    Finch
    Jacobs
    Olsen
    Evans
    
    
    
    
    
    
    
  4. Draw the binary tree your program would build if the names were given in the following order:
    Olsen
    Lamb
    Jacobs
    Finch
    Gates
    Davis
    Evans
    Atkins
    
    
    
    
    
    
    
  5. Using the file input_file given to you when you copied over the files from ~cs112/lab6, run your tree program and your list-based program (from Lab 5) on this file and fill in the table below based on the final output of each program.

    Name List Visits Tree Visits
       
       
       
       
       
       
       
       
       
       
       
       
       
       
       
       
       
       
       
       
       
       
       
       
       
       
       
       
       
       
       
       
       
       
       
       
       
       
       
       
       
       
       
       
       
       
       
       
       
       
       
    Total Visits: