[SOLVED] CS2050 Homework 5

35.00 $

Programming resource
Digital learning resource
Category:
✓ Practical programming resource
✓ Suitable for guided study and reference
✓ Tutor guidance available when needed

Description

5/5 - (5 votes)

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.

Resource details

Understand the Task Before You Use the Resource

Review the requirements, identify the programming concepts involved, study the implementation and test your understanding with your own examples and modifications.