Chapter 34 - Queues Flashcards
How is an abstract data type created?
» Data type that is created by the programmer, rather than defined within the programming language
What are some examples of structures contained in abstract data types?
» Queues
» Stacks
» Trees
» Graphs
What is an abstract data type?
» Logical description of how the data is viewed and the operations that can be performed on it
What is one good example of data abstraction?
» Where its up to the programmer to decide how to construct the data structure
» This encapsulates around the data, hiding the details of implementation from the user
What is a queue?
» A first in First out (FIFO) data structure
Where are elements added in a queue?
» At the end of a queue
Where are elements retrieved from?
» From the front of a queue
What does the sequence of data items in a queue is determined by?
» By the order they are inserted in
What is an example of how a queue is in real life?
» Imagine people printing out work to be printed at more or less the same time
» By putting the output into a queue on disk, the output is printed on a first come first served basis
What is a queue described as?
» An ordered collection of items which are added at the rear of the queue, and remove front the front
What happens if the first person in the queue leaves?
» The front pointer is made to the next point, the elements do not move, when a new person joins the queue, the rear pointer moves to the last item
» Think of a queue, in a doctor’s surgery, people leave and join the queue, but no one moves chairs
What does enQueue(item) do?
» Add a new item to the rear of the queue
What does deQueue do?
» Remove the front item from the queue and return it
What does isEmpty() do?
» Test to see whether the queue is empty
What does isFull() do?
» Test to see whether queue is full
What is a front pointer also known as?
» Header pointer