1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Mamont248 [21]
2 years ago
5

Chegg Suppose the heap is a full tree, size 2^n-1. what is the minimum number of steps to change a min heap to a max heap. Show

your logic.
Computers and Technology
1 answer:
adoni [48]2 years ago
4 0

Answer:

Explanation:

We start from the bottom-most and rightmost internal node of min Heap and then heapify all internal modes in the bottom-up way to build the Max heap.

To build a heap, the following algorithm is implemented for any input array.

BUILD-HEAP(A)

   heapsize := size(A)

   for i := floor(heapsize/2) downto 1

       do HEAPIFY(A, i)

   end for

Convert the given array of elements into an almost complete binary tree.

Ensure that the tree is a max heap.

Check that every non-leaf node contains a greater or equal value element than its child nodes.

If there exists any node that does not satisfy the ordering property of max heap, swap the elements.

Start checking from a non-leaf node with the highest index (bottom to top and right to left).

You might be interested in
In the Mouse Properties window, you can?
Levart [38]
Answer: option A. adjust the mouse's double-click speed.

You can see it in the attached file.


Download pdf
3 0
3 years ago
Based on the screenshot below which letter do you select to sort the items in an alphabetical order?
gladu [14]

Answer:

the smallest number start with the first number of the alphabet

6 0
3 years ago
Directions for starting the computer and opening a word processor document
aleksandr82 [10.1K]
First you download word after you open a page  and you start 
4 0
2 years ago
Supervisor: You will need to consolidate your trouble tickets
liubo4ka [24]
Wheres the rest???????????????????
7 0
2 years ago
The set of instructions that tell the computer what to do are called ____.
CaHeK987 [17]
Hi,

The word you are looking for is "programs".

Hope this helps.
r3t40
4 0
3 years ago
Read 2 more answers
Other questions:
  • What are the main types of computer software?
    5·2 answers
  • Write a calculator program using a switch statement that: a) Prompts the user to enter two numbers b) Prompts the user to select
    13·1 answer
  • Instructions Write a program that asks the user for a number. If the number is between 1 and 255, the program outputs the corres
    15·1 answer
  • Reasons for the growth of decision-making systems include:
    13·1 answer
  • Ten examples of an interpreter
    8·1 answer
  • I need help picture above
    14·2 answers
  • In what way, if any, has community building changed in the age of digital media? People’s community building has not changed in
    13·1 answer
  • What key value does Accenture’s myConcerto bring to clients looking for automated solutions?
    6·1 answer
  • Lesson 3 - Calling All Operators
    6·1 answer
  • How many levels of heading tags are allowed in html?
    13·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!