Comp202: Principles of Object-Oriented Programming II
Fall 2006 -- Exam 2 Need-to-Knows   


This list should be considered a partial list at best!  Check back often to see if new items are added.   You are responsible for all topics covered in class, labs and assignments, even if they do not appear here.

  1. Command-passing architectures, ala Rice MBS and self-balancing B-trees.
  2. Virtual-host architectures for visitors, ala Rice MBS.
  3. Extended visitor pattern to handle arbitrary numbers of hosts, ala self-balancing B-trees.
  4. Algorithms on B-trees (TreeN).
    1. Be able to write visitors to a TreeN.
    2. Be sure you understand how the insertion and deletion algorithms work.
  5. Dictionaries
    1. What is a dictionary?
    2. What are key-value pairs for?
  6. Hashing and hash-tables
    1. Understand the notion of hashing,
      1. What it is for?
      2. Advantages over binary search tree?
      3. Relationship between a hash table and a dictionary?
    2. Hashing functions: 
      1. What constitutes a "good" hashing function?
      2. Rehashing
      3. Chaining
    3. Using a hash table, in particular, Java's HashMap class.  Practice writing code to
      1. Store key-value pairs in a HashMap
      2. Retrieve values from a HashMap using a key
      3. Detect if a key doesn't exist in the HashMap
  7. Parsing
    1. Tokenizing
    2. Factoring
    3. Expressing of grammar in terms of classes.
  8. Review on anonymous inner classes:
    1. Initializer blocks

      If you need to do constructor-like processing in an anonymous inner class, use initializer blocks, which are execute only once, when the object is instantiated:
      	IClass c = new IClass() {
      		// initializer block defined by a pair of curly braces
      		{
      			// Runs after the superclass constructor.
      			// Call methods here.
      			// Set fields here.
      			// All needed variables are in scope!
      			// etc.
      		}
      		
      		// regular method and field definitions
      	
      	};
      	
      	
       
    2. Referencing nested anonymous inner classes:   An inner class can reference the outermost class and itself, but not any classes in-between.   To get around this, simply create a field in the inner class one wishes to reference that hold a reference to that object:
      	IClass c = new IClass() {
      		IClass first_c = this; // save the reference to the outer object.
      		
      		IClass another = new IClass() {
      			// "first_c" is in scope, so this object can reference it.
      		};
      	};
      	

 

 


Last Revised Thursday, 03-Jun-2010 09:52:23 CDT

©2006 Stephen Wong and Dung Nguyen