Question: Write a C + + class called priority _ queue that has the following FUNCTIONS using a heap and simulating a prioritized queue of integers

Write a C++ class called "priority_queue" that has the following FUNCTIONS using a heap and simulating a prioritized queue of integers with the highest priority value.
push(FUNCTION)
Description: Add a data to the prioritized queue
Input: An integer, which you want to add to the prioritized queue
Output: Nothing
Precondition: n is an integer
Postcondition: The prioritized row contains a new data.
pop(FUNCTION)
Description: Removes the data with the highest priority from the prioritized queue
Input: Nothing
Output: Nothing
Precondition: The prioritized row must contain at least 1 data.
Postcondition: The prioritized row is left without the data with the highest priority
top(FUNCTION)
Description: Returns the value of the data with the highest priority in the prioritized queue.
Input: Nothing
Output: The data with the highest priority within the prioritized row
Precondition: That the prioritized row contains at least 1 data.
Postcondition: Nothing
empty(FUNCTION)
Description: Returns a boolean value indicating whether the prioritized row is empty or has data.
Input: Nothing
Output: A boolean value indicating whether the prioritized row is empty or has data.
Precondition: Nothing.
Postcondition: Nothing
size(FUNCTION)
Description: Returns the amount of data in the prioritized row
Input: Nothing
Output: An integer value representing the amount of data in the prioritized row
Precondition: Nothing.
Postcondition: Nothing
input:
interaction according to the following menu. (the menu is NOT printed)
1. push
2. pop
3. print
4. top
5. is_empty
6. size
0. exit
output:
the result of the interaction
example of execution:
input:
5
1
51
1
37
5
1
64
1
32
1
16
4
1
96
2
2
3
0
output:
true
false
64
96
64
51371632
(output with details)
true
false
64
96
64
51371632
IMPORTANT: The names of the functions in the application must be respected.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!