0% found this document useful (0 votes)
17 views1 page

Array Implementation of Stack

LAB Program

Uploaded by

god122
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views1 page

Array Implementation of Stack

LAB Program

Uploaded by

god122
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

class Stack:

def __init__(self):
[Link] = -1
[Link] = 1000
[Link] = [0] * [Link]

def push(self, x):


[Link] += 1
[Link][[Link]] = x

def pop(self):
x = [Link][[Link]]
[Link] -= 1
return x
def display(self):
for i in range ([Link],-1,-1):
print([Link][i])

def Top(self):
return [Link][[Link]]

def Size(self):
return [Link] + 1

if __name__ == "__main__":
s = Stack()
[Link](6)
[Link](3)
[Link](7)
[Link]()
print("Top of stack is before deleting any element", [Link]())
print("Size of stack before deleting any element", [Link]())
print("The element deleted is", [Link]())
print("Size of stack after deleting an element", [Link]())
print("Top of stack after deleting an element", [Link]())

You might also like