Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

A d-ary max-heap, d-heap for short, is the generalization of a binary heap to a d-ary tree, for a fixed d greaterthanorequalto 2. Every node

image text in transcribed

A d-ary max-heap, d-heap for short, is the generalization of a binary heap to a d-ary tree, for a fixed d greaterthanorequalto 2. Every node can have up to d children, the tree has to be almost complete, and the max-heap property is fulfilled. (a) For given fixed h greaterthanorequalto 0 and d greaterthanorequalto 2, give a formula for the number n of nodes in a complete d-ary tree of height h. Your formula should depend on n and d. Justify its correctness. (b) Suppose a d-heap is stored in an array that begins with index 0. For an entry located at index i, in which location is its parent and in which locations are its children? (No formal proof necessary.) (c) What is the height of a d-heap that contains n elements? The height should be a function of n and d. Shortly justify your answer: a formal proof is not necessary. (d) Shortly explain how the insertion procedure works for d-heaps (you do not have to give pseudocode). What is the runtime of inserting an element into a d-heap of n elements? The runtime should be a function of n and d. (e) Shortly explain how the extract_max procedure works for d-heaps (you do not have to give pseudocode). What is the runtime in terms of n and d, where n is the number of elements in the heap

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

Seven NoSQL Databases In A Week Get Up And Running With The Fundamentals And Functionalities Of Seven Of The Most Popular NoSQL Databases

Authors: Aaron Ploetz ,Devram Kandhare ,Sudarshan Kadambi ,Xun Wu

1st Edition

1787288862, 978-1787288867

More Books

Students also viewed these Databases questions

Question

Why should a firm want to create an ethical culture?

Answered: 1 week ago