A priority queue is like a traditional queue but with an additional feature: the elements carry a priority and higher priority elements should be put in front of lower priority ones. The example below illustrates how a priority queue works using Disney duck characters.
| Action | State of Priority Queue | | —— | ———————– | | None | (front) (rear) | | Daisy arrives with “default†priority | (front)
{Daisy,0} (rear) | | Donald follows Daisy also with “default†priority | (front) {Daisy,0} {Donald,0} (rear) | | Scrooge shows up with priority
= 3 | (front) {Scrooge,3} {Daisy,0} {Donald,0} (rear) | | Huey shows up with priority = 2 | (front) {Scrooge,3} {Huey,2} {Daisy,0} {Donald,0}
Your goal on this homework is to finish the implementation of the push method in the PriorityQueue class implementing the TO-DO’s and passing all the tests.
Submission
You only need to submit the PriorityQueue.java source code this time.
CS2050, Homework, solved
[SOLVED] Cs2050 homework 5
$25
File Name: Cs2050_homework_5.zip
File Size: 160.14 KB
Only logged in customers who have purchased this product may leave a review.
Reviews
There are no reviews yet.