Question: It is desired to create a priority queue with max - heap - tree property in each row of an NxM matrix. On the other
It is desired to create a priority queue with maxheaptree property in each row of an NxM matrix. On the other hand, the capacity of each queue is different. The number of columns of the matrix should be determined according to the highest capacity of the priority queues. In each step, the highest priority of the first elements of the priority queues is removed from the relevant queue. These steps continue until there are no elements left in the queues. The algorithm you will design should print the idle queues on the screen in order.
Read the matrix dimensions N and M from outside.
The Ndimensional array storing the capacity of each priority queue must be read from outside.
The numbers you generate between K KNxM are randomly assigned to the matrix according to the size of the queues.
must be placed. There should be of each number in the matrix. In other words, the matrix should consist of "unique" numbers.
After random number placement in the matrix, the matrix should be printed on the screen. Then each
The priority queue should be edited to have the maxheaptree property and the new version of the matrix should be printed on the screen.
After all the queues are organized, it is expected to obtain the maximum elements from the queues and remove the highest one from the relevant queue.
After the element is removed, the relevant queue should be reorganized to have the maxheaptree property.
should be edited.
The new state of the matrix at the end of that step should be printed on the screen.
The number of the priority queue that is out of elements must be replaced by another array.
When all queues are empty, a series of screens with queue information should be printed.
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
