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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started