Using the heap implementation of a priority queue from Project 1, implement a program that keeps track

Question:

Using the heap implementation of a priority queue from Project 1, implement a program that keeps track of the user’s list of prioritized chores.


Data from Project 1

Using a heap, implement the priority queue ADT from Section 7.4. You can store the heap in arrays, similar to the solution to Self-Test Exercise 1. To have FIFO behavior for elements with equal priority, you should have a third array called entered. The value of entered[i] tells when the data in node number i entered the priority queue. For example, the first element added has an entered value of 1, the second element has an entered value of 2, and so on. When you are comparing two elements with equal priority, use the entered value to “break the tie” (so that if two elements have the same priority number, then the one with the earlier entered value will come out of the priority queue first).

Make sure you keep track of how many elements are in the heap so that if the size of the heap reaches the size of the arrays, you can increase the size of the arrays.

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Related Book For  book-img-for-question
Question Posted: