Professional Documents
Culture Documents
Stacks Data Structure
Stacks Data Structure
Stacks Data Structure
By Harsh
Definition of Stacks
A stack is a linear data structure that follows the Last In,
First Out (LIFO) principle. It consists of three main
operations: push, which adds an element to the top, pop,
which removes the top element and peek which returns the
top element in the stack. It uses a single pointer to track the
top element of the stack
Stacks
Follows the Last In, First Out (LIFO) principle, ideal for managing dynamic data and
function calls.
Queues
Follows the First In, First Out (FIFO) principle, suitable for managing data in
sequential order.
Stack Operations 2.3.1
For Paper 2, the Exam Board has required to have understanding
how to implement the stack.
● Implementing a Stack
● Empty function
● Push function
● Pop function
● Peek function
● Traverse function
Stack Operations 2.3.1
● Implementing a Stack
● Empty function
Stack Operations 2.3.1
● Push Function
● Pop function
Stack Operations 2.3.1
● Peek Function
● Traverse function
Exam Questions
Answer
Next Question