Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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 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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started