This preview shows page 1. Sign up to view the full content.
Unformatted text preview: Consider the maze shown below. We try to ﬁnd a shortest path from s to t . Formulate this problem as a graph-search problem and give an eﬃcient algorithm for this problem. s t Problem 3. (15 pts total) Apply the accounting method of the amortized analysis to show that the BUILD-HEAP procedure runs in O ( n ) time. (a) (10 pts) Suppose we put $3 on each node initially. Prove by induction that immediately after calling HEAPIFY( A,i ), the total credit of all the nodes in the subtree rooted at A [ i ] is greater than or equal to h + 1, where h is the height of A [ i ]. (b) (5 pts) Finish the proof that the BUILD-HEAP procedure runs in O ( n ) time....
View Full Document
This note was uploaded on 01/01/2011 for the course EE 5503 taught by Professor Yao-wenchang during the Fall '09 term at National Taiwan University.
- Fall '09
- Electrical Engineering