C-9.34 Given a heap H and a key k, give an algorithm to compute all the entries in H having a key less than or equal to k. For example, given the heap of 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. ((15,K)) (5,A) (9,F) (2,B) (7.0) ((4,C) (6,Z) W (16,X) (25,J) (14,E) ((12,H)) (11,S) (8,W) (20,B) (10,L) ((15,K)) (5,A) (9,F) (4,C) ((16,X)) (25,J) (14,E) (12,H) (7,Q) (6,Z) (20,B) (a) (b) 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.
C-9.34 Given a heap H and a key k, give an algorithm to compute all the entries in H having a key less than or equal to k. For example, given the heap of 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. ((15,K)) (5,A) (9,F) (2,B) (7.0) ((4,C) (6,Z) W (16,X) (25,J) (14,E) ((12,H)) (11,S) (8,W) (20,B) (10,L) ((15,K)) (5,A) (9,F) (4,C) ((16,X)) (25,J) (14,E) (12,H) (7,Q) (6,Z) (20,B) (a) (b) 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.
Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
Related questions
Question
Java
Please help me on Question 9.34

Transcribed Image Text:Z
C-9.34 Given a heap H and a key k, give an algorithm to compute all the entries in H
having a key less than or equal to k. For example, given the heap of 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.
(15,K),
(5,A)
(9,F)
(2,B)
(7,Q)
(4,C)
(6,Z)
W
(16,X) (25,J) (14,E) (12,H) (11,S) (8,W) (20,B) (10,L)
((15,K)
(5,A)
(9,F)
(4,C)
W
(16,X) (25,J) (14,E) (12,H)
Z
(7,Q)
(6,Z)
(20,B)
(a)
(b)
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.
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 2 steps

Recommended textbooks for you

Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON

Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science

Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning

Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON

Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science

Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning

Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning

Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education

Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY