What is a Queue?

This lesson provides an introduction to the "queue" data structure, its various uses, and its types.

Introduction

Similar to the stack, a queue is another linear data structure that stores elements in a sequential manner. The only significant difference between stack and queue is that instead of using the LIFO principle, queue implements the First in First Out (FIFO) method.

According to FIFO, the first element inserted is the one that comes out first. You can think of a queue as a pipe with both ends open. Elements enter from one end (back) and leave from the other (front). The following animation illustrates the structure of a queue.

Create a free account to view this lesson.

By signing up, you agree to Educative's Terms of Service and Privacy Policy