0% found this document useful (0 votes)
16 views4 pages

Chapter 03 Stacks Queues Deques

The document provides an overview of three data structures in Java: stacks, queues, and deques. Stacks operate on a Last-In, First-Out (LIFO) basis, while queues follow a First-In, First-Out (FIFO) approach. Deques allow insertion and deletion of elements from both ends, making them versatile for various applications in computer science and software engineering.

Uploaded by

abhimanyu thakur
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views4 pages

Chapter 03 Stacks Queues Deques

The document provides an overview of three data structures in Java: stacks, queues, and deques. Stacks operate on a Last-In, First-Out (LIFO) basis, while queues follow a First-In, First-Out (FIFO) approach. Deques allow insertion and deletion of elements from both ends, making them versatile for various applications in computer science and software engineering.

Uploaded by

abhimanyu thakur
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

STACKS, QUEUES AND

DEQUES
DATA STRUCTURES IN JAVA

Sercan Külcü | Data Structures In Java | 10.05.2023


Contents

Stacks ...........................................................................................................2
Queues.........................................................................................................2
Deques .........................................................................................................3

PAGE 1
Stacks

A stack is a collection of elements that supports two primary operations:


push and pop. The push operation adds an element to the top of the
stack, while the pop operation removes the top element from the stack.

One of the key characteristics of a stack is that it follows a Last-In, First-


Out (LIFO) ordering. This means that the most recently added element
is always the first one to be removed. To visualize this, you can think of
a stack as a pile of books or plates, where you can only add or remove
items from the top of the pile.

Stacks are widely used in computer science and software engineering.


They are used in programming languages to implement function calls,
in web browsers to store the history of visited pages, and in operating
systems to store information about processes and their state.

Queues

A queue is a collection of elements that supports two primary


operations: enqueue and dequeue. The enqueue operation adds an
element to the back of the queue, while the dequeue operation removes
the element from the front of the queue.

One of the key characteristics of a queue is that it follows a First-In,


First-Out (FIFO) ordering. This means that the first element added to
the queue is always the first one to be removed. To visualize this, you
can think of a queue as a line of people waiting for a bus or a
rollercoaster, where the person who arrived first is the first one to board.

Queues are widely used in computer science and software engineering.


They are used in operating systems to manage processes and their
priority levels, in networking to handle packet traffic, and in video and
audio streaming to buffer data.

PAGE 2
Deques

A deque, short for double-ended queue, is a data structure that supports


insertion and deletion of elements from both ends of the queue. This
means that you can add elements to the front or the back of the deque
and remove elements from the front or the back as well.

PAGE 3

You might also like