| | |
Summary: University of Wuppertal
Faculty C -- Department of Mathematics
Dr. Holger Arndt, Dipl.-Math. Sigrid Fischer
Algorithms and Data Structures
WS 2004/2005
Exercise Sheet 5
Exercise 15 (6 p.) Sketch the heap (represented as a tree) after each of the following
operations:
· insert the entries with the keys 43, 28, 19, 50, 34 and 20 in the initially empty
heap
· delete the entry with the maximum key
· delete the entry with the maximum key
Exercise 16 (6 p.) The following algorithm transforms the first n entries of the array
a into a heap.
for i = n
2
- 1, . . . , 0 do
k = i
correct_pos_found = false
while a[k] has any child and correct_pos_found = false do
|