Professional Documents
Culture Documents
EQUIPMENT:
• Computer equipped with Microsoft Visual Studio 15 and Office 16
BACKGROUND:
In computer science, a stack is an abstract data type that serves as a collection of elements, with
two principal operations:
Figure 1
LAB TASKS:
Problem 1:
We need to implement CharStack data structure using arrays that can store characters and have
the following public functionalities:
• Constructor: Ask the size of stack from user than allocate memory to the dynamic pointer
• Destructor : to delete the dynamic allocation done in the constructor
• bool push(char x): pushes x to stack
• bool pop(char & poppedElem): pops an element from stack in poppedElem and then
returns the success status
• IsFull(): return true if the stack is full
• IsEmpty(): return true if the stack is empty
Problem 2:
Write a C++ program to that reverses a string using stack. You should use your Stack class
implemented in problem1.
Problem 3:
You have to implement a program that can solve the parenthesis problem using stack.
Parenthesis problem says that every opening bracket should have corresponding closing bracket.
Assume that the user enters an expression (containing operators, operands, and brackets) in the
form of string. Create a function bracketAnalyzer with prototype bool bracketAnalyzer(string
exp); and perform the followings in its body:-
Problem 4:
We need to implement IntStack data structure using linked list that can store integer numbers
and have the following public functionalities:
• Constructor: Initializes the head of the stack
• Destructor
• Push(element)
• Pop()
Demonstrate
Understand
elementary skills Attempts Attempts lab
Attempts all the given
to construct partial lab tasks with
1 lab tasks with concept but No attempt
various data tasks with incorrect
correct output unable to
structures. correct output output
apply it
Completes
Behaves Completes
the lab task
responsibly, Completes the lab task Poorly
3 with help of Does not
and individually the lab task on with minor attempts lab
instructor and work
performs the his own help of tasks
students
lab. instructor
around