Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

3 - Heaps [20/100 points] For this problem, consider the array of integers [64, 32, 16, 8, 4, 2] a. [8 points] Draw (as a

3 - Heaps [20/100 points] For this problem, consider the array of integers [64, 32, 16, 8, 4, 2] a. [8 points] Draw (as a tree), the min heap that would result from adding each integer in the above array to an initially empty min heap one at a time, in order (starting with the 64). b. [2 points] What was the total number of swaps required when creating the min heap in part (a)? (Note we are looking for the total number of individual swaps, not the number of calls to fixUp or fixDown) c. [8 points] Draw (as a tree), the min heap that would result from calling heapify on the above array. d. [2 points] What was the total number of swaps required when creating the min heap in part (c)? (Note we are looking for the total number of individual swaps, not the number of calls to fixUp or fixDown)

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

SQL Server T-SQL Recipes

Authors: David Dye, Jason Brimhall

4th Edition

1484200616, 9781484200612

More Books

Students also viewed these Databases questions