Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Do not paste other's answer just need Algorithms Recall that our array indices start with 1. Use the same name and notation for heap-operations as

Do not paste other's answer

just need Algorithms

image text in transcribed

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

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

Beginning Databases With PostgreSQL From Novice To Professional

Authors: Richard Stones, Neil Matthew

2nd Edition

1590594789, 978-1590594780

More Books

Students also viewed these Databases questions

Question

=+Do you have relevant work experience

Answered: 1 week ago