CS 216 - Data Structures
Homework #8


Due: Wednesday 4/25 at the beginning of class

NOTE: This work is to be done in groups of 2-3.

Minimum Spanning Trees - Prim's Algorithm

Create a Java graphical minimum spanning tree demonstration MSTDemo that:

Your application may build on the Kruskal's algorithm demonstration code presented in class.

Note: A priority queue is necessary for Prim's algorithm.  Java's PriorityQueue class does not have the needed functionality of HEAP-INCREASE-KEY (Cormen et al, Introduction to Algorithms, 2nd ed, p. 140).  Note also that the HEAP-INCREASE-KEY procedure assumes that the index of the key is known by the caller.  A linear scan of the nodes to determine the index affects computational time complexity.  Maintaining a hash table to look up key indices provides a tradeoff of memory to keep this operation logarithmic.  Although your implementation need not be the most efficient, your computation for 1000 points should not require a significant wait.