Page 1 of 1

Implement Stack using array and corresponding push and pop functions. 1. Write a function named top that returns the top

Posted: Wed Apr 27, 2022 5:04 pm
by answerhappygod
Implement Stack Using Array And Corresponding Push And Pop Functions 1 Write A Function Named Top That Returns The Top 1
Implement Stack Using Array And Corresponding Push And Pop Functions 1 Write A Function Named Top That Returns The Top 1 (97.57 KiB) Viewed 25 times
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