A stack is an ordered list in which all insertions and deletions are made at one end, called the top.
Stacks
Introduction
to Stacks
•
Let us have the formal definition of the stack.
A stack is an ordered
list in which all insertions and deletions are made at one end, called the top.
If we have to make stack of elements 10, 20, 30, 40, 50, 60 then 10 will be the
bottommost element and 60 will be the topmost element in the stack. A stack is
shown in Fig. 4.1.1.

•
The typical example can be a stack of
coins. The coins can be arranged one on another, when we add a new coin it
is always placed on the previous coin and while removing the coin the recently
placed coin can be removed. The example resembles the concept of stack exactly!
•
Stack is called LIFO(Last In First Out)
data structure.
•
We will now discuss the operations which can be carried out on the stack. The
operations are as follows:
To
create a stack.
To
insert an element on to the stack.
To
delete an element from the stack.
To
check which element is at the top of the stack.
To
check whether a stack is empty or not.
Data Structures using C PlusPlus: Chapter 4: Stacks and Queues : Tag: Data Structure, C++ Programing : - Introduction to Stacks
Data Structures using CPlusPlus
CS25C05 2nd Semester ECE Dept | 2025 Regulation | 2nd Semester 2025 Regulation
English Essentials II
EN25C02 2nd Semester | 2025 Regulation | 2nd Semester 2025 Regulation
Tamils and Technology தமிழர்களும் தொழில்நுட்பமும்
UC25H02 2nd Semester | 2025 Regulation | 2nd Semester 2025 Regulation
Linear Algebra
MA25C02 2nd Semester | 2025 Regulation
Electron Devices
EC25C01 2nd Semester ECE Dept | 2025 Regulation | 2nd Semester 2025 Regulation
Data Structures using CPlusPlus
CS25C05 2nd Semester ECE Dept | 2025 Regulation | 2nd Semester 2025 Regulation
Circuits and Network Analysis
EC25C02 2nd Semester ECE Dept | 2025 Regulation | 2nd Semester 2025 Regulation
Re-Engineering for Innovation
ME25C05 2nd Semester | 2025 Regulation | 2nd Semester 2025 Regulation
Engineering Drawing - Laboratory
ME25C01 2nd Semester | 2025 Regulation | 2nd Semester 2025 Regulation
Data Structures using CPlusPlus - Laboratory
CS25C05 2nd Semester ECE Dept | 2025 Regulation | 2nd Semester 2025 Regulation
Devices and Circuits Laboratory
EC25C03 2nd Semester ECE Dept | 2025 Regulation | 2nd Semester 2025 Regulation