Designing a Hash Function
A hash function is a method that inspects the contents of an object and returns an integer value
such that
1. Objects with identical contents will return the same hash code
2. Objects with different contents will, with high proba

The call stack
In order to understand what happens when an exception is thrown we first need to fully examine
how method calls are handled when the program is executed. Each call to a method creates a
new stack frame; the stack frame holds the values of e

A binary search tree is a tree in which each node stores a key/value pair. The keys are ordered,
meaning that for any pair of keys a and b, it is possible to determine whether a<b, a>b, or a=b.
Each node obeys the binary search tree property:
In a binary

General rules:
1. a program statement that is not a method call: 1 step
2. loop executing n iterations: n * m, where m is the cost of a single loop iteration
(NOTE: m may be a function of which loop iteration is being executed)
3. method call: however man

When searching/inserting/removing an element from a hash table, the object's hash code is first
mapped to a hash bucket, which is simply an index into the array used to represent the hash
table. The hash bucket index is found by taking the hash code modul

Deletion
Deleting a key/value pair from the tree is more complicated than inserting. If the deleted key is
in a leaf node of the tree, then there is no problem; we can just delete the node containing the
key.
Deleting a node with a single child is also ea

As a finite series:
1 + 2 + 3 + . + N-2 + N-1
The sum of this series can be found by adding the first and last elements (1+( N-1)
= N), the second and next-to-last elements (2+( N-2) = N), and so forth. There are N/2
such pairs, each of which totals N. So

Recursion works by dividing a large problem into one or more smaller problems, and then
extending the solution to the smaller problem(s) into a solution for the large problem. For this
approach to work, three properties need to hold:
1. The smaller proble

Idealized Hash Table
Before getting into the details of real hash tables, let's first consider an idealized hash table that
has guaranteed worst case running time of O(1) for insert, delete, and find.
All hash tables are based on an object equality predic

In analyzing an algorithm, we are generally interested in its growth as N increases, rather than an
exact number of steps. Big-O refers to characterizing the growth of the exact cost T(n) of an
algorithm in relation to a simpler function f(n). Specificall