Stack 1
Stack 1
It is named stack as it behaves like a real-world stack, for example – a deck of cards or a
pile of plates, etc.
Stack is an abstract data type with a bounded (predefined) capacity.
It is a simple data structure that allows adding and removing elements in a particular order.
The order may be LIFO(Last In First Out) or FILO(First In Last Out).
Stack Data Structure:
Stack is a liner data structure which operates in a LIFO(Last In First Out) and
FILO(First In Last Out) pattern
Stack size = 3
Top =
Index = 0 , 1 , 2
Size = 1, 2 , 3
Items are add on top of stack.
This is known as PUSH operation.
pop()
Return the item at the top of the stack and then remove it. if pop is called when stack is empty,
it is in an underflow state.
isEmpty()
Tells if the stack is empty or not.
Isfull()
Tells if the stack is full or not.
Stack Data Structure Operations:
Peek()
Access the item at the i position
Count()
Get the number of items in the stack
Change()
Change the item at the i position
Display()
Display all the items in the stack.
Stack Data Structure Operations:
Peek()
Access the item at the i position
Count()
Get the number of items in the stack
Change()
Change the item at the i position
Display()
Display all the items in the stack.
Some Application Stack Data Structure:
Balancing of symbols
Mathematical/Logical/Abstract Models/View
Implementation.
ADTs are entities that are definitions of data and operations but do not have
implementation details.
Abstract Data Types in Data Structures.:
Data Structures: In computer science ,a data structure is a
data organization, management and storage form a that enables efficient access and
modification.
Mathematical/Logical/Abstract Models/View
Implementation.
ADTs are entities that are definitions of data and operations but do not have
implementation details.
Abstract Data Types in Data Structures.:
Real World Example: Smart Phone
Value of Array
1 2 3 4 5 6
0 1 2 3 4 5
Index of Array