DATA STRUCTURES AND ALGORITHMS CS 3139
Lecture:  April 8st, 1999








ANNOUNCEMENTS

HW4 out on web, due 04/20/1999 in class
Reading - Chapter 9
 
 

REVIEW

Disjoint set - solving equivalence problem
What is equivalence problem?  Given equivalence relation ~ defined on set S, a, bES, a~b?
What is equivalence relation?

Strategy - Define equivalence class a~b if a, b belong to same equivalence class

Approach

Idea

TODAY

Implement unions (find)
Smarter algorithm
Running time
Example

Union by size - smaller tree subtree of larger tree, S[root] = -size

[ We provided the code to implement this algorithm, as went through an illustrative example ]

Alternative - union by height

Shorter way Number 2 [ We provided the code to implement this algorithm, as went through an illustrative example ]
 
 

OPTIMIZATIONS

Union by size
Union by height
Path compression

Can we combine these methods?

Union by rank - Use height as estimate
 
 

ANALYSIS

Analysis of union/find algorithm

Akerman's Function [ We went through an example that illustrates Akerman's function ]

Grows very fast, thus inverse grows very slowly
p*(M,N) grows slower than log*N, where log*N is the number of times you log N until N<=1

BUILDING MAZES

 

  Nhat Minh Dau, nmd13@columbia.edu