Professional Documents
Culture Documents
May 5, 2023
# Stack Data Structure using array - Size of stack is fixed (Constant Size) - Insert and delete from
Top - LI-FO Implementation (Last-in First-Out) - Stack size will ask when you creating object of
stack - Some methods are given which help to manupilate your stack - push(value): Push is used
for insert data in stack - pop(): Pop is used for removed data from stack - peak(index): Peak is
used for access data by index - is_full(): is_full is used for current state of stack - print_all():
print_all is used for print all elements of stack - size_of_stack(): is used to find the size of stack.
1
def print_all(self):
rear = self.top_most
for ele in self.list:
print(self.list[rear],"-->", end=" "),
rear = rear -1
def size_of_stack(self):
print(f"Your size of stack is {str(self.size_of_array)}")
[306]: stack.push(30)
stack.push(40)
stack.push(50)
[307]: stack.list
[308]: stack.peak(0)
30
[309]: stack.is_full()
[310]: stack.print_all()
[311]: stack.size_of_stack()
[ ]: