Question

Draw the heap represented by the list [0, 2, 28, 16, 29, 33, 17, 20, 56,...

Draw the heap represented by the list [0, 2, 28, 16, 29, 33, 17, 20, 56, 76, 60] as a tree:

min heap

Homework Answers

Answer #1

Firstly, we set all the values of the list in a tree. [0, 2, 28, 16, 29, 33, 17, 20, 56, 76, 60]

As we know in min heap parent node always should be less than or equals to their child.

there are total no of node(n) = 11

we starting traversing the node from = n/2

=11/2=5.5

And , we start from 5th node, which is 29.

29 is already less than its child, then no need to traverse.

After 29 there are 4th node which is 16

16 is also less than its child, then no need to traverse.

After that 28 which is 3rd node.

there are 20 which is more then its parent so we replace the position of 17 and 28.

After that we check the 2nd node which is 2

2 is also less than its child.

in last we chaeck the 1st node which is 0

0 is also less than its child.

So, min heap tree is:

Answer.

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Calculate the following given this list... 10, 10, 10, 15, 16, 17, 17, 17, 17, 20,...
Calculate the following given this list... 10, 10, 10, 15, 16, 17, 17, 17, 17, 20, 21, 22, 24, 26, 28, 30, 31, 31, 31, 31, 31, 31, 31, 33, 34, 35 Min: Quartile 1: Median: Quartile 3: Max: Draw the box plot below. Label each of the five values
x y 23 28 17 20 8 2 29 22 12 18 Use the sample data...
x y 23 28 17 20 8 2 29 22 12 18 Use the sample data above to answer the following question.  (See exercise 56 on page 160 of your textbook for a similar problem.) Compute the correlation.
39 29 20 33 28 25 23 34 37 39 26 34 33 42 32 42...
39 29 20 33 28 25 23 34 37 39 26 34 33 42 32 42 45 24 32 41 48 36 16 13 40 A survey of 25 randomly selected customers found the ages shown​ (in years). The mean is 32.44 years and the standard deviation is 8.97 years. ​a) Construct a 99​% confidence interval for the mean age of all​ customers, assuming that the assumptions and conditions for the confidence interval have been met. ​b) How large is...
4th Grade (Class 1) 4th Grade (Class 2) 12 10 15 12 21 16 21 17...
4th Grade (Class 1) 4th Grade (Class 2) 12 10 15 12 21 16 21 17 22 17 22 19 22 19 25 22 26 22 27 22 27 27 31 28 32 29 33 29 33 31 36 31 37 31 38 33 41 33 43 37 44 39 45 43 45 43 47 47 55 49 57 57 The collected data is from two 4th grade (All female classes - Age 10) Fitnessgram pacer tests. Once you have...
selling price in $ frequency 12- 15 8 16-19 23 20-23 17 24-27 18 28-31 8...
selling price in $ frequency 12- 15 8 16-19 23 20-23 17 24-27 18 28-31 8 32-35 4 36-39 2 1.calculate the average selling price 2.calculate the median 3. construct a histogram 4. Describe the data
I don't know how to properly create a histogram. Question 8: Draw a histogram for the...
I don't know how to properly create a histogram. Question 8: Draw a histogram for the variable of TV watching hours. Based on the frequency table and histogram you create, write a paragraph summarizing the distribution of scores.    # of hours seniors watched TV Frequency 2-4 3 5-7 7 8-10 3 11-13 3 14-16 3 17-19 2 20-22 2 23-25 0 26-28 1 29-31 0 32-34 1
Student School_Ranking GPA Experience Salary 1 78 2.92 3 73,590 2 56 3.84 9 87,000 3...
Student School_Ranking GPA Experience Salary 1 78 2.92 3 73,590 2 56 3.84 9 87,000 3 23 3.04 6 76,970 4 67 3.20 6 79,320 5 56 3.61 7 79,530 6 78 2.99 5 71,040 7 68 3.78 8 82,050 8 89 3.20 5 78,890 9 37 3.42 7 82,170 10 67 3.05 5 76,120 11 48 3.12 4 77,500 12 78 3.56 7 83,920 13 56 3.01 5 71,800 14 25 3.15 6 77,000 15 68 3.05 7 79,000...
20 women and 30 men between 18 to 60 years old and the number of hours...
20 women and 30 men between 18 to 60 years old and the number of hours that they work. These information would be your populations. For each group find the followings: 20 Women Ages = 19, 23, 40, 18, 60, 50, 21, 30, 33, 28, 33, 35, 28, 24, 28, 18, 19, 22, 25, 50 20 women work hours weekly = 40, 24, 30, 31, 19, 10, 21, 5, 40, 9, 8, 40, 37, 12, 20, 40, 20, 10, 40,...
Sex (1 = Males, 2 = Females); Size_car (1 = Small, 2 = Medium, 3 =...
Sex (1 = Males, 2 = Females); Size_car (1 = Small, 2 = Medium, 3 = Large). Data ID   AGE   SEX   SIZE_CAR 1   18   1   2 2   28   1   2 3   44   1   3 4   20   2   2 5   39   2   2 6   53   2   3 7   28   1   1 8   18   1   1 9   24   2   1 10   21   1   2 11   35   1   3 12   38   1   3 13   22   1   1 14   29   1   2 15   63  ...
Question 2: Write a C program that read 100 integers from the attached file (integers.txt) into...
Question 2: Write a C program that read 100 integers from the attached file (integers.txt) into an array and copy the integers from the array into a Binary Search Tree (BST). The program prints out the following: The number of comparisons made to search for a given integer in the BST And The number of comparisons made to search for the same integer in the array Question 3 Run the program developed in Question 2 ten times. The given values...