Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Complete the following in python Write a program that inputs N elements. A minimum heap data structure should be created to hold the N elements

Complete the following in python
Write a program that inputs N elements. A minimum heap data structure should be
created to hold the N elements using the following two methods:
a. Elements inserted into the heap data structure one at a time
b. Use all the elements to build a heap in linear time (pass all the elements in at
once)
The input/creation process should be repeated 3 times using the following criteria:
a. the input elements should be sorted from smallest to largest
b. the input elements should be sorted from largest to smallest
c. the input elements should be randomized.
Compare the run times for each of the 6 different approaches.
If a d-heap is stored as an array, for an entry located in position i, where are the parents
and children? Be sure to note if your index starts at 0 or 1 and give examples
demonstrating the correctness of your formula.
image text in transcribed

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

Students also viewed these Databases questions