Alle boeken

Professioneel

Apps Over Coach Inloggen Begin met lezen

Computer Science · Begrippenlijst

Wat is Queue, enqueue, dequeue, FIFO?

Ook bekend als: queue · enqueue · dequeue · FIFO

Definition 24.4 High School Computer Science · Hoofdstuk 24 — Linked Lists, Stacks and Queues

A queue is an abstract data type holding a sequence, with the operations: create an empty queue; test whether it is empty; enqueue an element at the back; dequeue the element at the front, removing and returning it, refused on an empty queue. The first element enqueued is the first dequeued: the queue is FIFO, first in, first out.

A linked queue holding 5, 8, 2. Enqueueing 7 links a new cell after the tail and moves _tail to it (dashed); dequeueing moves _head to the next cell.
A linked queue holding 5,8,25, 8, 2. Enqueueing 77 links a new cell after the tail and moves _tail to it (dashed); dequeueing moves _head to the next cell.
A queue from two stacks. The transfer pops 3, 2, 1 from the in-stack and pushes them on the out-stack, where 1, the oldest, is now on top. The next two dequeues pop 2 and 3 with no transfer.
A queue from two stacks. The transfer pops 33, 22, 11 from the in-stack and pushes them on the out-stack, where 11, the oldest, is now on top. The next two dequeues pop 22 and 33 with no transfer.
Lees in het hoofdstuk →