Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

2. Consider a binary min-heap data structure that supports the INSERT and EXTRACT-MIN operations. In summary, INSERT adds the element at the leftmost available position

image text in transcribed
2. Consider a binary min-heap data structure that supports the INSERT and EXTRACT-MIN operations. In summary, INSERT adds the element at the leftmost available position in the last level of the heap, and performs upward swaps as needed. EXTRACT-MIN extracts the root, replaces it with the rightmost element in the last level of the heap, and performs downward swaps as needed. (See Chapter 6 of the textbook if you need a refresher.) INSERT and EXTRACT-MIN each take O(log n) in the worst case. [15pt.) (a) Show a potential function that results in an amortized cost of O(log n) for INSERT and O(1) for EXTRACT-MIN. (b) Fill out the following table to derive the amortized cost of INSERT and EXTRACT-MIN based on the potential function. Show your calculations. Operation Actual Cost AD Amortized Cost INSERT EXTRACT-MIN ? 2

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data And Databases

Authors: Jeff Mapua

1st Edition

1978502257, 978-1978502253

More Books

Students also viewed these Databases questions

Question

1. What is meant by Latitudes? 2. What is cartography ?

Answered: 1 week ago

Question

What is order of reaction? Explain with example?

Answered: 1 week ago