Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1. A priority queue is an abstract data type which is like a regular queue or some other data structures, but where additionally each element

1. A priority queue is an abstract data type which is like a regular queue or some other data structures, but where additionally each element has a "priority" associated with it. In a priority queue, an element with high priority is served before an element with low priority like scheduler.
If two elements have the same priority, they are served according to their order in the queue.
2. Use the heapify function or the heap sort algorithm discussed in the class to implement a priority queue program in any programming language you desire (C++ or java).
a. The program should be able to insert, delete and update the priority of the jobs.
b. The jobs should be heapified or be sorted according to their priorities.
c. Job priorities are to be assigned a number between 1 and 20.
d. Each job consists of Job #, Job Name, Submitter name, and priority.
3. The program should take the job #, Job name, Submitter, and Priority as input into Wait Queue. Enter m jobs to Wait queue where 10 < m < 15 not in sorted order.
a. Dislay the Wait Queue.
b. Heapify (or Heap Sort) the Wait queue, display the heapified or sorted Wait Queue
c. Move the highest priority job from Wait Queue to Ready Queue.
Move 4 times.
Heapify the Wait queue each time the Wait queue is changed.
Heapify the Ready Queue each time the Ready queue is changed.
Display the result of both queues after 4 moves from Wait queue to Ready Queue.
d. Delete 2 jobs from Ready queue and display the result.
The Ready queue must be heapified each time the Ready Queue is changed.
Display the result.
e. Add 2 more jobs to Wait queue, move 3 jobs from Wait queue to
Ready queue, delete 1 job from Ready queue. Display the result.
f. Change the priority of 2 jobs in the Wait Queue, display the result.
g. You must do more deletions until no more jobs are in the Wait Queue and Ready Queue.
h. When you display the result, you must include the entire job information,
not just job #.
i. When you swap the priorities of two nodes, you must also swap the associated attributes.
j. When deleting or moving a job, you may assume you are deleting the job with the highest priority.
k. You must use the heapify or the heap sort function, and the priority queue functions to carry out the above job queue changes.
need wait and ready queues in program

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

0.0505% of $50,000 is what amount?

Answered: 1 week ago

Question

At what level(s) was this OD intervention scoped?

Answered: 1 week ago