Question: PLEASE ANSWER IN JAVA QUESTIONS 1 & 2 IS ONE QUESTION I WILL UPVOTE IF CORRECT!!! 1. Using your favorite programming language (Java is suggested),
PLEASE ANSWER IN JAVA

QUESTIONS 1 & 2 IS ONE QUESTION
I WILL UPVOTE IF CORRECT!!!
1. Using your favorite programming language (Java is suggested), design and implement a stack on an array. Implement the following operations: push, pop, top, size, isEmpty. Make sure that your program checks whether the stack is full in the push operation, and whether the stack is empty in the pop operation. 2. Practical application 1: Arithmetic operations. (a) Design an algorithm that takes a string, which represents an arithmetic operation, as input and checks whether or not the brackets are correct (balanced) or incorrect (unbalanced). The input string may contain a combination of the following characters: {},,[],,(),0,1,2,3,4,5,6,7,8,9,,+,, , /. An obvious hint for this algorithm is to use the stackbased solution discussed in class as a template, and hence you can use the stack implemented in \#1. Your algorithm must not check the correctness of the arithmetic operators/operands, but only check for balanced brackets. Your algorithm should also show an error message when the string contains a character that is not one of those listed above. Provide the pseudocode of the algorithm. (b) Implement the algorithm of (a) in your favorite programming language. Run the program in several cases, including the following (more examples to be asked when the assignment is submitted): i. (9[3{[(3+3)/5]7}]) iii. ((3(9(4(65)))) ii. {3(2+[3[4/[6/9]]]}) iv. {2{3{6/[[[(((90)))]]]}}/7} (c) Consider an input string of size n : (i) what is the worst-case time that your algorithm takes to decide whether or not the string is correct (balanced) or incorrect (unbalanced)? (ii) Why? Give your answers in terms of the O-notation
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
