Question
Consider our binary tree HEAP data structure. Recall that it supports INSERT and EXTRACT_MAX in O(log n) worst case time, where n is the number
Consider our binary tree HEAP data structure. Recall that it supports INSERT and EXTRACT_MAX in O(log n) worst case time, where n is the number of elements in the PRIORITY QUEUE.
(a) Give a potential function 4) such that the amortized cost of INSERT is O(log n) and the amortized cost of EXTRACT_MAX is O(1) with respect to ϕ. Justify your answer.
(b) Prove that for any constant c, the potential function ϕ(H) = c × size(H) is not a solution to (a).
(c) Consider a sequence of n EXTRACT_MAX operations performed on a heap H that initially contains n elements. Does the fact that the amortized cost of each EXTRACT_MAX operation is O (1) mean that the entire sequence can be processed in 0(n) time? Justify your answer.
Step by Step Solution
3.35 Rating (158 Votes )
There are 3 Steps involved in it
Step: 1
a Let the real cost of ...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get StartedRecommended Textbook for
Fundamentals of Physics
Authors: Jearl Walker, Halliday Resnick
8th Extended edition
471758019, 978-0471758013
Students also viewed these Chemical Engineering questions
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
View Answer in SolutionInn App