Question: Practical application 1 : Arithmetic operations. ( a ) marks ] Design an algorithm that takes a string, which represents an arithmetic operation, as input
Practical application : Arithmetic operations.
a marks 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: 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 # Your algorithm must not check the correctness of the arithmetic operatorsoperands 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 marks 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
iii.
ii
iv
c marks Consider an input string of size : i what is the worstcase time that your algorithm takes to decide whether or not the string is correct balanced or incorrect unbalancedii Why? Give your answers in terms of the Onotation.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
