- 2 Implement A Class Template Minheap That Has The Following Declaration Class Minheap Node Heap An Array Of Nodes 1 (27.3 KiB) Viewed 15 times
2- Implement a class template MinHeap that has the following declaration: class MinHeap ( Node heap; //an array of nodes
-
- Site Admin
- Posts: 899603
- 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