3 Show the result of performing three deleteMin operations in the heap of theprevious | StudySoup

Textbook Solutions for Data Structures and Algorithm Analysis in Java

Chapter 6 Problem 6.3

Question

3 Show the result of performing three deleteMin operations in the heap of theprevious exercise.

Solution

Step 1 of 2

Consider that the below heap to apply the deleteMin operation:

                                                   

The deleteMin operation deletes the minimum value from the heap, which is the root. In a heap above, when 1 is deleted, the root candidates will be 3 and 2. To satisfy the heap order, choose the minimum value that is 2. This follows down the length of the heap in a similar fashion. The heap after the first deletion is given below:

                                                     

The second deleteMin operation will delete the next minimum value from the heap, which is the root again. In the heap above, when 2 will be deleted, the candidates for the root will be 3 and 4. To satisfy the heap order, choose the minimum value that is 3. This follows down the length of the heap in a similar fashion. The heap after the second deletion is given below:

                                                       

Subscribe to view the
full solution

Title Data Structures and Algorithm Analysis in Java 3 
Author Mark A. Weiss
ISBN 9780132576277

3 Show the result of performing three deleteMin operations in the heap of theprevious

Chapter 6 textbook questions

×

Login

Organize all study tools for free

Or continue with
×

Register

Sign up for access to all content on our site!

Or continue with

Or login if you already have an account

×

Reset password

If you have an active account we’ll send you an e-mail for password recovery

Or login if you have your password back