Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

help me............. 3' For an array A = [(11, a2, a3, a4] of distinct numbers, there are two main ways to build a heap, as

help me.............

image text in transcribed
3' For an array A = [(11, a2, a3, a4] of distinct numbers, there are two main ways to build a heap, as described in class. In parts (a) and (b) of this problem you must show what comparisons each method will make, in the form of a binary decision tree. Each leaf should contain output in the form of some permutation of the input subscripts in A (e.g., if you write 3124 it means that after building the heap we have A = [(13, a1, a2, a4]. (a) Do the above (draw the decision tree) for the forward method. (b) Do the above (draw the decision tree) for the reverse method. (c) Describe your own heapbuilding algorithm that specically handles inputs of size 4, and draw the corresponding decision tree that uses fewer decisions in the worstcase compared to the meth ods in (a) and (b). Your algorithm should be described in English, not pseudocode

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

Pre Algebra Practice Workbook The Most Comprehensive Review Of Pre Algebra

Authors: Reza Nazari

2024th Edition

1637195591, 978-1637195598

More Books

Students also viewed these Mathematics questions