Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Recall that our array indices start with 1. Use the same name and notation for heap-operations as in the textbookotes. You may use any standard-heap
Recall that our array indices start with 1. Use the same name and notation for heap-operations as in the textbookotes. You may use any standard-heap operation without specifying details. . You may assume that the values stored in the heap are integers. (1) (10 pts) (la) Present algorithm indexBottomLeft(h) that, given a nonempty min- heap h, returns the array-index of the left-most node at the bottom- most level. On a minheap of size n, your algorithm must run in O(log n) time. You are forbidden to use any math library functions/methods/algorithms. (1b) Present algorithm deleteBottomLeft(h) that, given a nonempty min- heap h, deletes the value in the left-most node at the bottom-most level from minheap h (resulting in a smaller minheap). On a minheap of size n, your algorithm must run in O(log n) time. (2) (10 pts) Present algorithm delete (h, i) that, given a nonempty minheap h and a valid array-index i, deletes the value in the node with array- index i (i.e value in the node at h[i]) from minheap h (resulting in a smaller minheap). On a heap h with n nodes your algorithm must run in O(log n) time
Step by Step Solution
There are 3 Steps involved in it
Step: 1
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 Started