Fundamentals of Computer Science II (CSC-152 99F)


Class 41: Search Trees

Back to Dictionaries. On to Hash Tables.

Held Thursday, November 11, 1999

Overview

Today we continue our discussion of dictionaries with a few possible implementation strategies.

Notes

Contents

Summary


A Dictionary Interface


/**
 * Very simple dictionaries that map keys to values.
 *
 * @author Samuel A. Rebelsky
 * @version 1.0 of November 1999
 */
public interface Dictionary {
  /**
   * Add an entry to the dictionary.
   * Pre: The key and value are non-null.
   * Pre: The key can be compared to other values in the dictionary.
   * Post: Subsequent calls to get(key) will return value.
   *
   * @exception Exception
   *   If the key cannot be compared.
   */
  public void put(Object key, Object value)
    throws Exception;

  /**
   * Look up an entry in the dictionary.
   * Pre: The key is non-null.
   * Pre: The key can be compared to other values in the dictionary.
   * Post: Returns the value most recently "put" with the key.  
   *
   * @exception Exception
   *   If the key cannot be compared or there is no such entry.
   */
  public Object get(Object key)
    throws Exception;

} // interface Dictionary


A Simple Dictionary Implementation

Search Trees

Another Perspective: Binary Search Trees for Binary Search


History

Tuesday, 10 August 1999

Wednesday, 10 November 1999

Back to Dictionaries. On to Hash Tables.


Disclaimer Often, these pages were created "on the fly" with little, if any, proofreading. Any or all of the information on the pages may be incorrect. Please contact me if you notice errors.

This page may be found at http://www.math.grin.edu/~rebelsky/Courses/CS152/99F/Outlines/outline.41.html

Source text last modified Wed Nov 10 20:58:01 1999.

This page generated on Wed Nov 10 21:01:54 1999 by Siteweaver. Validate this page's HTML.

Contact our webmaster at rebelsky@grinnell.edu