Question

5. Heap, 5pts] The following elements are inserted into an empty Max-Heap in the fol- la-FHea lowing order: 2, 3. 1, 4, 6. 12, 15, 22, 11, 5 Draw the resulting heap (use the logical (tree) representation)

0 0
Add a comment Improve this question Transcribed image text
Answer #1

E lements Insented into maxheap ane 2,31,4,6, 12 15, 22, 11,5 11 0nden to build a max-heap. finst e need to build binany tlee

At node Jeft node is gneaten than Pasent node ( 12)). Scoap them. sight. node is gneaten than panent node (157リ. Soap them. a

  At node i left nade is gneaten than the faskat node (a2) sexpthem. sight node iS dess than fasent C1 sat). no need to Sone ca

At node left node is goeaten than Pas ent node (11%)Scaapthem gight node is tess than panent node (6e11). No Scapsreiu 22)1 2

Add a comment
Know the answer?
Add Answer to:
5. Heap, 5pts] The following elements are inserted into an empty Max-Heap in the fol- la-FHea...
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
  • (e) Consider an initially empty max-heap, where the following keys are to be inserted one at...

    (e) Consider an initially empty max-heap, where the following keys are to be inserted one at a time: 11, 19, 23, 12, 13, 17, 13, 14, 18, and 33. Draw the tree that results after building this max-heap. (f) Is it possible to find the maximum in a min-heap in O(log n) time? Justify. Important Notes: • For part (e) of this problem, you must draw the min (or max) heaps using the appropriate graphics tools at your convenience.

  • c++ *construct (draw) a Max Heap when the following keys are inserted in the given order:...

    c++ *construct (draw) a Max Heap when the following keys are inserted in the given order: 5, 10, 4, 3, 1, 15, 11, 12, 20, 19, 2 *What is the index of the right child of key 20? *Draw the max Heap after performing removeMax()

  • Consider the following max-heap stored as an array: <7, 6, 4, 2, 5, 1, 3>. Draw...

    Consider the following max-heap stored as an array: <7, 6, 4, 2, 5, 1, 3>. Draw this max-heap as an (undirected) binary tree and give both adjacency-list representation and adjacency-matrix representation of the binary tree

  • 1. Which of the following is a proper array representation a binary min heap?

    1. Which of the following is a proper array representation a binary min heap?2. A heap is implemented using an array. At what index will the right child of node at index i be found? Note, the Oth position of the array is not used.Select one:a. i/2b. 2 i+1c. i-1d. 2 i3. Consider the following array of length 6. Elements from the array are added, in the given order, to a max heap. The heap is initially empty and stored as an array.A={18,5,37,44,27,53}What...

  • ALGORITHM AND DATA STRUCTURES Question Question 1: Convert the following binary tree into a heap using...

    ALGORITHM AND DATA STRUCTURES Question Question 1: Convert the following binary tree into a heap using the Heapify algorithm. Draw the diagrams of the tree step by step after every alteration. Question 2: Show the heap that results when the items are inserted into the heap one by one, starting with one that is empty. 7, 3, 8, 1, 4, 20, 11, 33, 45, 23, 6 Question 3. Draw the 2-3-4 tree that results when values are inserted in the...

  • [Heap] Create a min-binary heap using following numbers (appearing/inserting in the given order): 5, 22, 19,...

    [Heap] Create a min-binary heap using following numbers (appearing/inserting in the given order): 5, 22, 19, 56, 50, 25, 1, 3, 10, 6, 32, 12, 11                [Hint: you can put the items in sequence in a binary tree and then use the buildHeap() method.] [Hashing] Consider a hash table where the hash function h is defined as the modulo 10 operation i.e., for any integer k, h(k) = k % 10 (the ‘modulo 10’ operator returns the remainder when k...

  • Consider the min-priority queue implemented by a binary heap. (The max-priority queue is treated in §6.5...

    Consider the min-priority queue implemented by a binary heap. (The max-priority queue is treated in §6.5 Priority queues in the textbook.) Show the binary tree implemented by the array A = 〈5, 8, 9, 11, 10, 12, 10, 12, 15, 11, 14, 13, 16, 15〉. Show the binary tree resulting from Heap-Insert(A, 6) where A is the array in (a). Show the binary tree resulting from Extract-Min(A) where A is the array in (a). Show the binary tree resulting from...

  • 5. A three-heap with n elements can be stored in an array A, where A[O] contains...

    5. A three-heap with n elements can be stored in an array A, where A[O] contains the root of the tree. a) Draw the three-heap that results from inserting 5, 2, 8, 3, 6, 4, 9, 7, 1 in that order into an initially empty three-heap. You do not need to show the array representation of the heap. You are only required to show the final tree, although if you draw intermediate trees. b) Assuming that elements are placed in...

  • A max-heap with 10 elements is given in the following array format. The following three sub-questions...

    A max-heap with 10 elements is given in the following array format. The following three sub-questions all refer to this max heap. i 1 2 3 4 5 6 7 8 9 10 A[i] 99 90 80 70 60 50 40 30 20 10 Show the result after applying heap-increase-key(A, 9, 95) to the max-heap at the top of this page: i 1 2 3 4 5 6 7 8 9 10 A[i] Show the result after applying heap-extract-max(A) to...

  • 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...

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