Thursday, July 4, 2019

CS2040: Queue ADT

Queues

Queues are First in First Out

Operations for Queues consiste of:
  • poll
Grab the first element and remove it
  • peek
Look at the first element without removing it
  • offer/enqueue
Add an element to the back of the queue

Queue Interface


Queue implemented Array

We can use Arrays to implement queues.
Use an array with front and back pointer.
                            



 Using TailedLinkedList

We cant use basic due to the need to addlast
Composition:





No comments:

Post a Comment