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 "priorityqueue" that has the following FUNCTIONS using a heap and simulating a prioritized queue of integers with the highest priority value.
pushFUNCTION
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.
popFUNCTION
Description: Removes the data with the highest priority from the prioritized queue
Input: Nothing
Output: Nothing
Precondition: The prioritized row must contain at least data.
Postcondition: The prioritized row is left without the data with the highest priority
topFUNCTION
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 data.
Postcondition: Nothing
emptyFUNCTION
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
sizeFUNCTION
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
push
pop
print
top
isempty
size
exit
output:
the result of the interaction
example of execution:
input:
output:
true
false
output with details
true
false
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
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
