Sign InCoursewareNuggetsTutorials CoursesCodePad

What is a Queue?

In general, a queue is a line of people or things waiting to be handled, usually in a sequential order starting at the beginning of the line. The word queue is pronounced exactly like the letter "Q". A real-world example of queue can be a single-lane one-way road, where the vehicle enters first, exits first. More real-world examples of queues can be seen at the check-out counters or bus-stops.

a queue of people waiting in line
the queue data structure

In computer science, a queue is an ordered linear data structure, somewhat similar to stacks. Unlike stacks, a queue is open at both its ends. One end (called the rear) is always used to insert data and the other end (called the front) is used to remove data. Two operations are allowed to modify a queue: enqueue means to insert an item into the rear of the queue, and dequeue means removing the front item. Queue follows first-in first-out (FIFO) principle, i.e., the item added first will be removed first.

© CS Wonders·About·Gallery·Fun Facts·Cheatsheet