Skip to content
← Computer Science

Computer Science · 2nd Puc Optional

Ch 4Queue — 2nd PUC Computer Science, concept-first.

A queue is a data structure that follows the First-In-First-Out (FIFO) principle. This is the opposite of a stack, which works on Last-In-First-Out (LIFO). In a queue, the element that is added first is the one that gets removed first.

14

Q&A

6

Concepts

Not available

Exam weightage

Start learning — read this chapter →

Key concepts

Hover a concept to preview it and jump to its most relevant Q&A.

Queue Underflow Handling

Imagine you're standing at a ticket counter. The queue has a fixed number of people waiting. Now suppose the counter clerk keeps serving customers one by one, but no new customers join the line.

Start with this concept →

Chapter contents

The NCERT structure, section by section. Open a section to see its questions, then read the concept-first solution.

4.1

Introduction to Queue

A queue is a data structure that follows the First-In-First-Out (FIFO) principle. This is the opposite of a stack, which works on Last-In-First-Out (LIFO).

4.1.1

First In First Out (FIFO)

A queue is built on a simple, real-world rule: the first person to join the line is the first person to be served. This principle is called First In First Out, or FIFO.

4.1.2

Applications of Queue

A queue is a linear data structure that follows the First In, First Out (FIFO) principle — the element that enters first is the one that leaves first.

4.2

Operations on Queue

The queue follows the First In, First Out (FIFO) principle. This means the element that has been in the queue the longest is the first one to be removed.

4.3

Implementation of Queue using Python

3 Q

A queue is a linear data structure that follows the First In, First Out (FIFO) principle — the element added first is the one removed first.

4.4

Introduction to Deque

A deque (pronounced “deck”) is a data structure where elements can be added or removed from either end — the front (head) or the rear (tail).

4.4.1

Applications of Deque

2 Q

A deque (double-ended queue) is a data structure that allows insertion and deletion from both ends — front and rear.

4.4.2

Operations on Deque

A deque (double-ended queue) is a data structure that allows insertion and deletion of elements from both ends — the front and the rear.

4.5

Implementation of Deque using Python

A deque (pronounced "deck", short for double-ended queue) is a linear data structure that allows insertion and deletion of elements from both ends — the front and the rear.

Summary

- A queue is an ordered linear data structure that follows the FIFO (First In, First Out) strategy: the element added first is removed first.

Exercises