(Problem C-9.34, page 397 of the text) Given a heap H and a key k, give an algorithm to compute all the entries in H having keys less than or equal to k. For example, given the heap in figure 9.12a and query k=7, the algorithm should report the entries with keys 2, 4, 5, 6, and 7 (but not necessarily in this order). Your algorithm should run in time proportional to the number of entries returned, and should not modify the heap.
Figure 9.12: Two cases of updating the last node in a complete binary tree after operation insert or remove. Node w is the last node before operation insert or after operation remove. Node z is the last node after operation insert or before operation remove.
(2,B) (4,C) (5,A) (4.C) (5.A) (6,2) (15,K) (9,F) (7.0) (6,Z) (15.K) (9,F) (7.Q) (20.B) 7 ん (16.X)) ((25,J) ((14.E)) ((12,H) 2

Comments

Popular posts from this blog

Why Rockets Explode: Understanding the Risks and How SpaceX is Addressing Them

Escitalopram StatPearls