Category Archives: Discussions

Symbol Tables Concepts

Definition

A symbol table is a data structure for key-value pairs that supports two operations:

  1. insert (put) a new pair into the table
  2. search for (get) the value associated with a given key

  1. Only one value is associated with each key (no duplicate keys in a table).
  2. When a client puts a key-value pair into a table already containing that key (and
    an associated value), the new value replaces the old one

The associative array abstraction, where you can think of a symbol table as being just like an array, where keys are indices and values are array entries.

In a conventional array, keys are integer indices that we use to quickly access array values; in an associative array (symbol table), keys are of arbitrary type, but we can still use them to quickly access values.

Keys must not be null. As with many mechanisms in Java, use of a null key results in an exception at runtime

In java, no key can be associated with the value null.

Searching cost model
When studying symbol-table implementations, we count compares (equality tests or key comparisons). In (rare) cases where compares are not in the inner loop, we count array accesses.

N dragon curve using turtle graphics

screen-shot-2016-09-19-at-8-14-42-pm

Dragon curve. Use the program, Dragon.java that reads in a command-line parameter N and plots the order N dragon curve using turtle graphics. The dragon curve was first discovered by three NASA physicists (John E. Heighway, Bruce A. Banks, and William G. Harter) and later popularized by Martin Gardner in Scientific American (March and April 1967) and Michael Crichton in Jurassic Park.
Describe in a short paragraph how the program works.
dragon_curve_animation

220px-fractal_dragon_curve

400px-dragoncurve_animation

Wikipedia

 

 

 

 

 

 

 

 

 

 

Mandelbrot Set

Faster Madelbrot

Speed up Mandelbrot by performing the computation directly instead of using Complex. Compare. Incorporate periodicity checking or boundary tracing for further improvements. Use divide-and-conquer: choose 4 corners of a rectangle and a few random points inside; if they’re all the same color, color the whole rectangle that color; otherwise divide into 4 rectangles and recur.

screen-shot-2016-09-19-at-8-43-22-pm