Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Use the heapify function or the heap sort algorithm to implement a priority queue program in any programming language you desire (C++ or java). a.

Use the heapify function or the heap sort algorithm 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.

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

Recommended Textbook for

Data Management Databases And Organizations

Authors: Richard T. Watson

2nd Edition

0471180742, 978-0471180746

More Books

Students also viewed these Databases questions

Question

1. Explain how business strategy affects HR strategy.

Answered: 1 week ago