Lab 03 - Stack
Lab 03 - Stack
Lab 03 – Stack
Exercises/Tasks:
1. Create a Stack using Array. Implement all required methods (push, pop, peek,
getSize, isEmpty, isFull, printAll (print values in first-to-last order)). Besides, show
its functionality by calling its different methods in the main method.
2. Create a Stack using Linked List. Besides, show the functionality of the Stack by
calling its different methods in the main method.
3. Implement a function that uses a stack to check if a given string is a palindrome.
Then, show its working by calling it in the main method.
4. Write a method that uses a stack to check if a given string of parentheses
(including parentheses (), braces {}, and brackets []) is balanced or not. Then,
show its working by calling it in the main method.
5. Write a program to sort a stack such that the smallest items are on the top. You
can use only one additional stack to hold items temporarily.
6. Any 2 Task from leetcode, related to Stack.
Linked List
7. Write a program to reverse a singly linked list.(Same linked list)
8. Write a program to remove duplicate from linked list.