Guidelines: Pqa T
Guidelines: Pqa T
EECE 330
Lab 7 – Fall 2020
Guidelines
• This assignment is due on Thursday, November 19, 2020 at 11:55 pm.
• Build your code incrementally. Make sure you keep a backup of your working code. Build
and test your program for each task.
? You are supposed to submit your own work. We have a zero tolerance policy for cheating.
Penalties may include one or more of the following: zero grades on programming assignments,
failing the course, disciplinary committee, Dean’s warning, and suspension.
? Lab attendance is mandatory. Violating this rule can lead to a failing grade.
• A constructor that takes an array a and its size n and constructs the priority queue with all
elements in a.
– For pqa t, implement the heapify algorithm as a separate method and call it from the
constructor.
• Method insert(e) that takes an element e and inserts it in the priority queue while preserving
order.
– Pay attention to the array used for storing the elements in pqa t. Use a dynamic array
methodology. Hint: you may use vector.
• Method extract() that removes the top element in the priority queue and returns it.
• Use the pqa t constructor to build a heap for a randomly generated large array N = 10000
and measure the time needed to construct the priority queue.
• Use method insert to construct a pqa t object from the same array and measure the time
needed.
• Use the STL priority queue class to construct a priority queue with the same array and
measure the time needed. Try both approaches.
1
– Use the constructor that takes an array (or a vector) container to construct the priority
queue.
– Use the typical constructor with the push back method to construct the priority queue.
• Based on the time measurements, what do you think the implementation in the STL priority queue
is?