Professional Documents
Culture Documents
Hw5 C2a Vergara
Hw5 C2a Vergara
2.0
U nle a shing Possibilit ie s
Stores data as a sequence of elements like a The last item of the data connects back to
real-world queue the first item, creating a circle
Possible to enter new items through the rear, Possible to enter and remove items from
and remove items through the front any position of the queue
Requires more memory Requires less memory
Less efficient More efficient
2.0
U nle a shing Possibilit ie s
The Congo Line Dance is also one example where circular queueing can be seen
in performance action, as people enter from the rear end of the circular queue but can
exit from the front or randomly.
Both examples can be considered imperfect circular queue as in reality, they don’t
fully follow the same consistent exit through the front of the queue. But with the right
situations or conditions, they do function as such, where members of the queue exit right
at the front of the queue.
CI TE
2.0
U nle a shing Possibilit ie s
Stores data as a sequence of elements like a Stores data with regards to the priority
real-world queue value of the element
Possible to enter new items through the rear, Insertion and removal don’t happen at a
and remove items through the front specific end, it happens through priority
choice
Elements stay at the same FIFO order Elements are re-ordered to make the front
whenever an element is pushed onto the of the queue contain the element with the
back or popped off the front smallest or largest value depending on
order priority
Popping out elements follow the FIFO Popping out elements always come out in
(First In First Out) order either ascending or descending order
Requires more memory compared to circular queue
Less efficient than circular queue
2.0
U nle a shing Possibilit ie s
A hospital applies priority queue during emergencies, whether there are sudden
appearance of patient/s who need immediate assistance. From such, prioritized patients
are immediately assisted first to the emergency room over other patients with less
priority concerns.
Traffic lights apply priority queues on the colors it is supposed to show, depending
on the traffic situation. One prioritization example that a traffic signal can perform is
extending relative green time depending on the flow of mixed traffic on the crossing
street, particularly on times where there is a significant amount of pedestrian flow
compared to vehicle flow in a specific time.
CI TE
2.0
U nle a shing Possibilit ie s
5. Your references.
• Geeks for Geeks. (2020). Difference between Circular Queue and Priority Queue. Retrieved from
https://www.geeksforgeeks.org/difference-between-circular-queue-and-priority-queue/?ref=rp
• Lithmee. (2019). What is the Difference Between Linear Queue and Circular Queue. Retrieved
from https://pediaa.com/what-is-the-difference-between-linear-queue-and-circular-queue/
• Stack Overflow. (2016). What is a real lif e example of a ring buffer/circular queue. Retrieved
from https://stackoverflow.com/questions/40203296/what-is-a-real-life-example-of-a-ring-
buffer-circular-queue