Question

6. (8 pts) Illustrate the algorithmic operations on the maximum binary heap data sti perations on the maximum binary heap da

Please ignore red marks. Thanks

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

Answer is attached in the form of images. At the top page no is written. Please see.

PAGE NO Page ① COATE 28 <elements_ At ;=4 ACJE Z E lements y=9 7 ds are not greater than 9. So Ho Change No macheanify call f

+ 00 Backspace Num Lock II Page 2 4 index 7=2 largest = ADI 8 ... element A[r]= 3 ... element exchange 6 with 8 i-2 largest =

PAGE No. DATE Page (3) Macheapify (1) ACIE 8 largest = 3 ... index largest not equal to i... True Swap ① of ③ Apply Maxcheapi

PAGE No. DATETT Page 9 Now Hepp-Ex trocke Max on the new here constructed A heapsize=9 ... Me under flow max= AC1 = 9 AC] = A

Backspace PAGE NO. Apply max heapify on A Clargest] - AC2 je on 6 Apply max beapify am A14 ] ie on ③ Fimal heap oo 0 I After

Add a comment
Know the answer?
Add Answer to:
Please ignore red marks. Thanks 6. (8 pts) Illustrate the algorithmic operations on the maximum binary...
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
  • How do I write this in the c++ language? 1. (10 points) Write a program to...

    How do I write this in the c++ language? 1. (10 points) Write a program to implement Heapsort. The input should be an array of size at least 15. Have the user enter the values or you can specify your own array (unsorted). The output should be the final sorted array AND print out the values in the max heap (just the heap, NOT the full array) after each MAX-HEAPIFY (after BUILD- MAX-HEAP i.e. don't print output in BUILD-MAX-HEAP) in...

  • Algorithm Please answer Number 6 right and clearly! Thanks a lot For Problems #4 through #6,...

    Algorithm Please answer Number 6 right and clearly! Thanks a lot For Problems #4 through #6, consider the following pseudocode (ref: CLRSpp. 154-160): 01 HEAP SORT (A) 02 BUILD-MAX-HEAP (A) 03 for i A. length downto 2 04 exchange A [1] and Ali 05 A heapsize A heapsize 1 06 MAX-HEAPIEY (A, 1) 07 BUILD-MAX-HEAP (A) 08 A heapsize A. length 09 for i floor (A length/2) down to 1 10 MAX-HEAPIEY (A ,i) 11 MAX-HEAPIFY (A,i) 12 L 2*i...

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

  • Data structures Exercises: For the following binary tree (Index-Value): 0 1 2 3 4 5 6...

    Data structures Exercises: For the following binary tree (Index-Value): 0 1 2 3 4 5 6 7 8 9 A C E G B P D X F H Give the pre-order traversal. Give the post-order traversal. Give the in-order traversal. Determine the height of the tree. Using these values: 8 6 4 3 5 9 2 1 6 Build a binary search tree. Build an AVL Tree. Build a 2-3 Tree. Build a min-heap. Build a max-heap. Apply a...

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

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

  • PROGRAM DESCRIPTION Using the given class definitions for either C++, create a minimum heap that stores...

    PROGRAM DESCRIPTION Using the given class definitions for either C++, create a minimum heap that stores integers and and implements a minimum priority queue. (Your program can be "hard coded" for integers - it does not need to use templates, generics, or polymorphism.) Your data structure must always store its internal data as a heap. Your toString function should return a string with the heap values as a comma separated list, also including the size of the heap as well....

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

  • braw the binary min heap that results from inserting 8, 7, 3, 2, 4, 6, 9,...

    braw the binary min heap that results from inserting 8, 7, 3, 2, 4, 6, 9, 5, 1 in that order into an initially empty binary min hea p. Show final tree and the array representation of the heap. No need to show the intermediate work. 0 5 6 8 10 12 9. Consi der the binary heap shown below. What would the heap look like after deleteMin operation is performed? Show your work. 13 28 44 61 60 68...

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

  • Need help with the trickle down This is the maxheap.h #ifndef MAXHEAP_H_INCLUDED #define MAXHEAP_H_INCLUDED #include <vector>...

    Need help with the trickle down This is the maxheap.h #ifndef MAXHEAP_H_INCLUDED #define MAXHEAP_H_INCLUDED #include <vector> #include <sstream> #include <string> #include <queue> #include <cmath> // pow() using namespace std; #define PARENT(i) ((i-1) / 2) #define LINE_WIDTH 60.0 template<class T> class MaxHeap{ // private: vector<T> heap; void bubbleUp(int id);    void Heapify() { int length = heap.size(); for(int i=length / 2 -1; i>=0; --i) trickleDown(i); }; public: MaxHeap( vector<T> &vector ) : heap(vector) { Heapify(); } ; MaxHeap() {}; void trickleDown(int...

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