Question

Suppose the following array was created by heapDown during the heap creation part of the He 87 48 71 4015 [14 pts] Show the array as a tree. Show all the changes in the tree/array during the sort part Heapsort. a. 87
0 0
Add a comment Improve this question Transcribed image text
Answer #1

ธา 148171 luolis 4g HEAP SORTA BOILD-MAX- HEAP (A) length Down to 오 exchane AL th ALT MAX. HEAPI (AT SiOaps us USi 15 15

IF YOU HAVE ANY QUERIES PLEASE POST A COMMENT THANK YOU

Add a comment
Know the answer?
Add Answer to:
Suppose the following array was created by heapDown during the heap creation part of the He...
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. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • NOTE:  Completing the Third Chart is the most important. This is one question with three parts. (4 pts) Is the following array-based tree a min-heap or a max-heap or not a heap at all? 85 91 S8 95 1...

    NOTE:  Completing the Third Chart is the most important. This is one question with three parts. (4 pts) Is the following array-based tree a min-heap or a max-heap or not a heap at all? 85 91 S8 95 100 92 a. Min-heap b. Max-heap c. Not a heap 5 pts) Turn the following array-based binary tree into a max-heap. Show your work step by step. (You will not need all the columns) 34 7 12 47 19 5 pts) Show...

  • 1. Consider an array of size eight with the numbers in the following order 40, 20,...

    1. Consider an array of size eight with the numbers in the following order 40, 20, 80, 60, 30, 10, 70, 50. (a) What is the array after heap creation? Make sure to form the heap bottom up as done in class. How many comparisons does the algorithm use? (b) Show the array after each element sifts down during the remainder of heapsort, and state how many comparisons each sift takes. What is the total number of comparisons for the...

  • QUESTION 16 Show the first pass of sorting the following array-based binary tree max-heap. In other...

    QUESTION 16 Show the first pass of sorting the following array-based binary tree max-heap. In other words, show the first step in sorting, then re-heap the remaining tree into a max-heap. For answers that are not used, put null. You may use scratch paper to draw the trees if you wish. (You will not need all the columns)

  • (c) Draw the binary heap structure that is equivalent to the following list (the root is...

    (c) Draw the binary heap structure that is equivalent to the following list (the root is first element). [5, 9, 8, 12, 15, 11, 19, 14, 20, 18, 17, 13] [4 marks] (d) Show the resulting tree after the value 6 is added to the heap in the part (c). Note that the binary heap properties must be restored after insertion. Show your working; you may show the data structure in tree or array form. [3 marks]

  • Tree & Hash Table & Heap Use the following integer keys 73, 58, 91, 42, 60,...

    Tree & Hash Table & Heap Use the following integer keys 73, 58, 91, 42, 60, 130, 64, 87 to perform the followings: a) Binary Search Tree - Draw a binary search tree - Retrieve the integers keys in post-order - Retrieve the integers keys in pre-order - Draw a binary search tree after node 58 is deleted b) Create a Hash Table using the methods described below. Show the final array after all integer keys are inserted. Assumes that...

  • Question 3. a. Draw the binary min heap represented by the following array: (5 points) 1...

    Question 3. a. Draw the binary min heap represented by the following array: (5 points) 1 2 4 6 7 Value 4 9 12 29 17 14 16 b. Show the result of calling deleteMin twice on the heap you drew in part (a). Show the heap after each deleteMin, and circle the final heap. (5 points) c. Starting with the heap you ended up with in part (b), insert values 11 & 2 in that order. Draw the heap...

  • 3. (8 points) Using the implementation of binary search tree operations we discussed in class, draw...

    3. (8 points) Using the implementation of binary search tree operations we discussed in class, draw the trees that result from the following operations: (a) Inserting 142, 400, 205, 127, 100, 320, 160, 141, and 110 into an initially-empty tree (in that order). (b) Deleting 142 from the tree you drew for part (a). 4. (8 points) Draw the unique binary tree that has a preorder traversal of 4, 1, 6, 3, 7, 5, 9, 2, 8 and an inorder...

  • Write a Java program, In this project, you are going to build a max-heap using array...

    Write a Java program, In this project, you are going to build a max-heap using array representation. In particular, your program should: • Implement two methods of building a max-heap. o Using sequential insertions (its time complexity: ?(?????), by successively applying the regular add method). o Using the optimal method (its time complexity: ?(?), the “smart” way we learned in class). For both methods, your implementations need to keep track of how many swaps (swapping parent and child) are required...

  • JH: Student Name: 4) Given the following array, do the following (show all the work). A...

    JH: Student Name: 4) Given the following array, do the following (show all the work). A (56, 89, 23, 58, 22, 11, 45, 48, 90) (a - 5 pts) Construct a hash table for the given array using the hash function H(K)- K mod 5 (b- 4 pts) Determine the average number of comparisons for a successful search using the hash table of (c -3 pts) What is the worst case number of comparisons for an unsuccessful search in the...

  • Suppose a binary tree data (in tiny written size) is stored in an array (A) as...

    Suppose a binary tree data (in tiny written size) is stored in an array (A) as given below and root is placed at “0”index. Note the array indices are in larger written size (0 to 74). Show the traversal data of the given tree for a)      In-Order Traversal b)     Post Order Traversal A 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 3 28 13 36 15 9 22 44 7 10 75 33 19 15...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT