Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Given an array of integers, do the following (SHOW ALL THE STEPS: just writing the final answer will get only ZERO) Clear label your answers

image text in transcribed
image text in transcribed
Given an array of integers, do the following (SHOW ALL THE STEPS: just writing the final answer will get only ZERO) Clear label your answers for each of the sub parts (a)- (), in the space provided. (a - 12 pts) Construct a max heap of the array. Show the initial essentially complete binary tree and the transformation of the binary tree to a max heap via the reheapify operations at the indices of the internal nodes (as shown in the slides) (b-12 pts) Sort the max heap version of the array obtained from (a) to obtain a sorted array of integers. Show the structural changes of the max heap in each iteration. (c -7 pts) Transform the max heap of (a) to a binary search tree. (d-8 pts) For the binary search tree obtained in (c, determine the average number of comparisons fora successful search and the average number of comparisons for an unsuccessful search. (e-8 pts) Use the sorted array of (b) to construct a binary search tree. (f-7 pts) For the binary search tree obtained in (e), determine the average number of comparisons for a successful search and the average number of comparisons for an unsuccessful search. (g-7 pts) Construct a hash table of the given array using a hash function H(K) - K mod 5. (h-7 pts) For the hash table of (g), determine the average number of comparisons for a successful search and the worst case number of comparisons for an unsuccessful search. G- 14 pts) Consider the elements of the array assigned to you are known only one at a time. Construct a sequence of priority queues (as max heaps) with the insertion (enqueue) of one element at a time, as shown in the slides. G-7 pts) Transform the binary search tree of (c) to a min heap. (k -7 pts) Transform the max heap of (a) to a min heap via reheapify operations at the internal nodes (1- 4 pts) Are the min heaps of G) and (k) the same or not? What can you say about the distribution of the data in the min heaps of (G) and (k)

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

Understanding Databases Concepts And Practice

Authors: Suzanne W Dietrich

1st Edition

1119827949, 9781119827948

Students also viewed these Databases questions

Question

Why is the System Build Process an iterative process?

Answered: 1 week ago