Professional Documents
Culture Documents
LAB # 09 Stack Implementation: Object Theory
LAB # 09 Stack Implementation: Object Theory
SSUET/QR/114
LAB # 09
Stack Implementation
Object
To implement Stack as Arrays and linked list.
Theory
Push (ITEM)
N:=N+1
Return
Pop (ITEM)
Return item
IsEmpty ()
IsFull ()
Sample Program
LAB TASK
1. Write a program to create Stack that can take input random candies color (i.e. yellow, green,
orange, red etc) and stored in order. The user likes any one of the colored candy to eat so he
takes out all the candies, one by one, eats only the chosen color and keeps other in order so
that he can return them to stack in exactly the same order as before minus the chosen candies.
Print both the input and resultant stack. For example:
2. Create a Stack Class which can store Strings in the stackArr. Let the stack be empty. Input 5
Strings change their case & then push them onto the stack. Pop the Strings & display them.
HOME TASK
1. Write a program to convert Infix expression into postfix expression by stack using linked list.
A + ( B * C - ( D / E | F ) * G ) * H