Question: Design and implement an index minimum priority queue C++ template class which takes keys of generic type. Name your class IdxMinPQ, and implemented using a
Design and implement an index minimum priority queue C++ template class which takes keys of generic type. Name your class IdxMinPQ, and implemented using a contiguous-array based binary heap.
IndexMinPq(int N)//create indexed priority queuewith indices 0, 1, ..., N 1 void insert(int i, Key key) // associate key with index i void decreaseKey(int i, Key key) //decrease the key associated with index i bool contains(int i) //is i an index on the priority queue? int delMin() //remove a minimal key and return its associated index bool isEmpty() //is the priority queue empty? int size() //number of keys in the priority queue };
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
