Homework #2 - Review Problems for Final Exam
Due Date: Tuesday, December 7, 1999
1) For the array of values shown below, show what happens to the array with the Heapsort algorithm discussed in class and given in the Kruse text and notes. I.e., show the data changes in the array at each step/change as the algorithm executes to completion. First, the algorithm will turn the array into a maxheap, and then the algorithm will finish by executing the sort.
| 30 | 10 | 50 | 80 | 40 | 20 | 60 | 5 | 90 | 70 |
| 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
2) Show all the memory components (e.g. found array, distance array, min) and
their values as you trace through the algorithm for Dijkstra's Shortest Path on
the following directed graph. Be sure to also show what this graph would
look like in both adjacency table and "mixed" adjacency list form.
3) For the undirected graph shown below, trace through Prim's Minimum Spanning Tree algorithm and show all calculations that are made in memory as the algorithm executes to completion. Be sure to draw the adjacency matrix for this undirected graph.
4) Do problem 1.2 a) b) c) d) from your handout on FSMs and FSRs.