Answer 3 and 4 Revieui ADQunue, Priority Queue, and Dequeue ? Define the ADT: a.
ID: 3706650 • Letter: A
Question
Answer 3 and 4
Revieui ADQunue, Priority Queue, and Dequeue ? Define the ADT: a.queue e priority queue 2 Indicate the Big o rate of gcouth of cun-time for s insertion into a queue that is implemented uaing an ordinaty component zexo obe always array with the front of the queue always maintained in componment zero of the array front of the queue always maintained in array with the component zero of the array using an ordinary c. deletion trom a queue using a cireular array implementstion Given the following 1ist of jobs and their associated priority class (the lower the number the higher the priority) (back) 314211 3 24ront) Assuming that no other jobs acrive, 1ist the order in which these jobs would be processed if a. apriority queue is used b. describe three different schemes by which a priority class might be assigned to a job c, explain what is meant by "starvation" d explain what is meant by "aging" e. briefly describe the form of the data structure that you would use to implement this ADT (include a diagram) 4. Given that a queue is being represented by the following circúlar representation in an array (front is currently 4 and back is currently 7) array component 1 37 41 12 1 34 a show what this representation would like after the following sequence of operations are performed: deq (q, il degiq, 11 engiq, 81) engig, 72) enqiq, 38) degiq, k) (indicate the current position of front and back) b. what is an advantage of this implementation of a queue ? c. what is a disadvantage of this implementation of a gueue?Explanation / Answer
Solution:
Note: 3 is done completely as per Chegg guidelines, please repost 4.
3)
a)
If a priority queue is used then the jobs will be executed according to the priority which they are assigned which means
The order will be
The lower the number the higher the priority
J22 J56 J17 J30 J45 J18 J12
we have considered the front item to be executed first when the priority is same.
b)
The priority can be based on
c)
A starvation happens when there is a livelock,
this means that a process is waiting forever for the execution
d)
When a process is taking too long to execute
This means that the burst time of the process is too high.
e)
Heap data structure can be used to create this ADT.
I hope this helps if you find any problem. Please comment below. Don't forget to give a thumbs up if you liked it. :)