Your assignment is to write and compare two implementations of a priority queue whose highest priority element is the one with the smallest key value. The elements have the following declarations:
The first implementation uses a minimum heap. You need to modify the heap operations to keep the minimum, rather than maximum, element in the root. The comparison function should compare key fields.
The second implementation uses a linear linked list, whose elements are ordered by key value.
Test Data
Create a data set that contains 50 items with priorities generated by a random-number generator.
Comparing the Implementations
To compare the operations, you must modify the Enqueue and Dequeue operations to count how many elements are accessed (compared or swapped, in the case of reheaping) during its execution. Write a driver to Enqueue and Dequeue the 50 test items and print out the number of elements accessed for the Enqueue and Dequeue operations. Run your driver once with each implementation.
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference
and should not be submitted as is. We are not held liable for any misuse of the solutions.
Please see the frequently asked questions page
for further questions and inquiries.
Kindly complete the form.
Please provide a valid email address and we will get back to you within 24 hours.
Payment is through PayPal, Buy me a Coffee
or Cryptocurrency.
We are a nonprofit organization however we need funds to keep this organization operating
and to be able to complete our research and development projects.