2- Implement a class template MinHeap that has the following declaration: class MinHeap ( Node heap; //an array of nodes
-
answerhappygod
- Site Admin
- Posts: 899604
- Joined: Mon Aug 02, 2021 8:13 am
2- Implement a class template MinHeap that has the following declaration: class MinHeap ( Node heap; //an array of nodes
2- Implement a class template MinHeap that has the following declaration: class MinHeap ( Node heap; //an array of nodes int _size; //size of array public: Node extractMin (); //returns & removes the node with minimum cost void buildMinHeap (Node [], int);// allocates array then builds a min-heap from an array of struct Node with the given size void minHeapify (int i, int n);//restores the min-heap property for the "heap" array using the given index and size n void decreaseKey (char label, int newCost);//decreases the node that has the given label to newCost int parent (int i);//returns the index of the parent of i int getSize();//returns size of the heap bool inHeap (char);//checks if the node with the given label is in the heap
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!