Page 294 - Learn to Program - Basic-256
P. 294
Chapter 19: Stacks, Queues, Lists, and Sorting Page 278
Enqueue
(Add One)
Item
Item Item Item Item
Item
Dequeue
(Take One)
Illustration 32: What is a Queue
The terms enqueue (pronounced in-q) and dequeue (pronounced dee-q) are
the names we use to describe adding a new item to the end of the line (tail)
or removing an item from the front of the line (head). Sometimes this is
described as a "first-in, first-out" or FIFO. The example in Program 117 uses
an array and two pointers that keep track of the head of the line and the tail
of the line.
1 # queue.kbs
2 # implementing a queue using an array
3
4 global queuesize, queue, queuetail, queuehead,
inqueue
5
6 call createqueue(5)
7
8 call enqueue(1)
9 call enqueue(2)
© 2019 James M. Reneau (CC BY-NC-SA 3.0 US)

