Skip to content

Commit ab51103

Browse files
committed
stack defintion
1 parent a10cf71 commit ab51103

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

DSA/stack.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
# Stack
2+
# Stack is an ordered collection of items where the addition of new items and removal items
3+
# always taken place at same end.
4+
# So the end is called as top.
5+
# And the opposite end is known as base.
6+
# Stack stored items in Last In First Out (LIFO) or First In Last Out (FILO)
7+
# Stack stores the data element in similiar fashion ,
8+
# as the bunch of plates are kept one above the another in a kitchen.
9+
10+
# If you add an object in a stack it will store in a base and second store top of the 1'st object
11+
# like that way it will stores
12+
# If you want to remove the top first object it is called (LIFO)or(FILO)
13+
114
# Stack implementation in python
215

316
print("_______________________________________________________")
@@ -33,3 +46,5 @@ def pop(stack):
3346
push(stack, str(4))
3447
print("popped item: " + pop(stack))
3548
print("stack after popping an element: " + str(stack))
49+
50+

0 commit comments

Comments
 (0)