Implement Stack using array and corresponding push and pop functions. 1. Write a function named top that returns the top
-
answerhappygod
- Site Admin
- Posts: 899604
- Joined: Mon Aug 02, 2021 8:13 am
Implement Stack using array and corresponding push and pop functions. 1. Write a function named top that returns the top
Implement Stack using array and corresponding push and pop functions. 1. Write a function named top that returns the topmost element of the stack. Note that both pop and top functions return the topmost element of the stack, but the top function simply returns it while the pop function removes the topmost element as well. 2. Write a program that checks whether a given string containing left and right parentheses are balanced or not. Assume that the input string will contain only left or right parenthesis. Sample Input Sample output () Balanced ) ( Not balanced 3. Extend the above problem so that it can now process all three bracket pairs "(",)', '{, *}', [ and ). Sample Input Sample output ([l) Balanced Not balanced (D)] ([}) Not balanced (){}[] Balanced
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!