Question: 5. The queue data structure may be used to store the jobs (in a waiting queue) that are to be executed on a processor. However,

 5. The queue data structure may be used to store the

5. The queue data structure may be used to store the jobs (in a waiting queue) that are to be executed on a processor. However, the first in first out policy cannot be applied universally as a job may have higher priority than others. Thus, assume that every job has an associated priority value as well. Explain the insertion and deletion of new jobs in the waiting queue which has been implemented using a linked list with proper diagrams and code snippets and as little text as possible. Each node in the linked list, represents a job, will have three parts: name/ID, priority, and the address of the next node. Assume that priority value is represented by an integer starting with 1 (highest priority). Note that insertion must take care of the priority: a new node will be inserted after (i) every node with the higher priority (a smaller value), and (ii) every node with the same priority value, if any. However, in case of deletion, the first node will always be deleted. [Text: 1 marks, Diagrams: 1 marks, Code snippets: 4 marks] [8] Following is an example of such a linked list. Job ID Priority Address of the next node * * * 12 1 2 4 37 2 23 6 59 9

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 Databases Questions!