stack Abstract Data Structure in python | Introduction of stack in python | What is stack | Explain stack data structure in python |
1. Stack is a linear Data Structure.
2. Stack is an order collection of element where the element can be inserted or deleted at only one end called Top of stack.
Stack Abstract Data Structure (ADT) :
2. Stack is an order collection of element where the element can be inserted or deleted at only one end called Top of stack.
3. The opposite end is known as the base.
4. The insertion or deletion (Push and Pop) operation on stack are done in Last In First Out (LIFO) manner. i.e. The element inserted last will be deleted first.
Example – stack of dish, stack of coins, stack of plates, stack of book etc.
Figure shown the concept of stack using example of stack of books.
Above figure top most book of stack is indicate by Top we can’t taken out the c++ unless all the book above it have all ready taken out or withdraw .
Consider the example in below figure.
a) Pushing value 19
b) Pushing value 5
c) Resulting stack after value 19 & 5 are added
d) Popping top value 5
Note- Basic operation on stack with Implementation of stack is show in next post
4. The insertion or deletion (Push and Pop) operation on stack are done in Last In First Out (LIFO) manner. i.e. The element inserted last will be deleted first.
Stack ADT |
Example – stack of dish, stack of coins, stack of plates, stack of book etc.
Figure shown the concept of stack using example of stack of books.
Figure: - A Stack of Book |
Above figure top most book of stack is indicate by Top we can’t taken out the c++ unless all the book above it have all ready taken out or withdraw .
Consider the example in below figure.
Figure: Abstract view of a stack
|
a) Pushing value 19
b) Pushing value 5
c) Resulting stack after value 19 & 5 are added
d) Popping top value 5
Note- Basic operation on stack with Implementation of stack is show in next post
Post a Comment