The data structure course is designed with queues to achieve the following

CSDN Q & A 2022-02-13 07:32:22 阅读数:542

data structure course designed queues

Set of data elements : A collection of data elements of the same type , Each of these data items has a specific priority . Items with higher priority are deleted before items with lower priority ; Items with the same priority are served on a first come first served basis (FIFO) In order to delete . Basic operation : (1)Make: Construct an empty priority queue . (2)Size: Returns the number of elements in the priority queue . (3)IsEmpty: Returns true if the priority queue is empty , Otherwise return false . (4)Insert: Insert a data element into the priority queue . (5)FindMax: lookup 、 Return the highest priority element . (6)DeleteMax: Delete 、 Return the highest priority element . programme : Suppose that the job entering the computer system (job) Given an assignment number (number) And one from 0~9 Priority in 0,9 Represents the maximum and minimum priority, respectively . The job number is stored in a priority queue , Write a program to store jobs with priority , And allow the user to select the menu operation :R Delete A increase L list . about R, Read out the job number with the highest priority and delete it from the priority queue , If there are multiple queues with the highest priority at present, delete the job with small job number from the limited queue ; about A, Read in the job number and priority , Then according to the above rules, it is added to the priority queue ; about L, Then all job numbers and priorities in the queue are listed . The job number can be expressed as an integer , It can be given by the system when the job enters the system . Complete with queue




Take the answer :

For queues ,c# Yes queue class . You can refer to the methods of this class .


copyright:author[CSDN Q & A],Please bring the original link to reprint, thank you. https://en.javamana.com/2022/02/202202130732204969.html