Algorithms

Spring 2007
course
navigation

march 5

6.1

Searching a list by presorting it.
do 6.1 #6 in class.

6.3

balanced search trees
The basic notion is that we keep our information organized in a binary tree so that we can find things in it quickly, with a binary search. The price we pay is more complexity in adding and deleting elements, which requires "rotating" various parts of the tree to keep it balanced.
If it doesn't remain balanced, then we're left with the possibility of trees that extend down in only one direction ... and then searching for something turns into sequential search.
Note the differences between these and heaps: heaps place keys in a different order (bigger than children), and have all levels but last full. Heaps are *not* designed to optimize searching.
Do 6.3 #1 in class. (Careful: all nodes are binary ... even if both links aren't shown.)

6.4

heaps and heapsort
A heap is a binary tree with
Definition: a "heap" is a binary complete (except for bottom which may have some right nodes missing) tree with parent key's > children's.
Do 6.4 #1 in class.

6.5

Finding a**n mod m efficiently:
Do an example on the board.

6.6

reduction
Example on pg 244 : river-crossing problem as a graph-search problem (state-space)
"AI is the branch of computer science in whcih state-space graphs are a principle subject."
http://en.wikipedia.org/wiki/State_space_search
http://cs.marlboro.edu/ courses/ spring2007/algorithms/ notes/ march_5
last modified Wednesday October 22 2008 5:05 pm EDT