Description
Programming assignment 3
Priority queue.
Input (Standard input)
Each line of input consists of at most three integers.
If the first integer is 0, print the output and terminate the program.
If the first integer is 1, insert the second integer.
If the first integer is 2, extract the maximum number from the priority queue.
If the first integer is 3, substitute the third integer for the element indexed by the second number. After the modification, the heap structure must be restored. Assume that the smallest index of the priority queue is 1.
If two children’s keys are same, right child must swap with parent.
Output (Standard output)
In the first line, print the extracted elements. In the second line, print the current heap.
[Example]
Input Output
1 16 16 14
1 15
1 10
1 14
1 7
1 9
1 3
1 2
1 8
1 1
3 2 4
2
2
0 10 8 9 4 7 1 3 2
Description
1. File name must be PriorityQueue.cpp
2. Make a comment of your student ID, name and class in the first line of the source code.
ex) 2008601028_Honggildong_A or 2008601028_홍길동_A
3. Please keep the source code that you have submitted for some unexpected accident.




Reviews
There are no reviews yet.