1.we will take only the opening and closing brackets in the if condition not the values.To check balanced parentheses in an expression using a stack.
2.At the end of the string if the stack is empty then it is valid expression.
3.In the below example also we check the stack at the end.
![o rnola soli Given Expression string is : T a*(-)/[[3-d]* (4 +9] 61) Note: - & we will read only the opening and the closing](http://img.homeworklib.com/questions/a8bd0e30-be5d-11ea-957c-dffd076705ab.png?x-oss-process=image/resize,w_560)

![step: -6 Read string - a*(6-0 [[[3-d] * Cut 1 ILC * opening ic bracket so push it into stack step-7 Read string – at (6-0) [[](http://img.homeworklib.com/questions/aa20ec20-be5d-11ea-922e-858c7d6b1f65.png?x-oss-process=image/resize,w_560)
2. Check for balanced parentheses in an expression using a stack. Given the expression string below,...
Problem Implement (in C) an algorithm that uses a stack to check if a parentheses sequence is balanced. Note that a parentheses sequence is balanced if it is of the form (S) or of the form (SS), where S is any balanced parentheses sequence. See the courseware for more information on balanced parentheses sequences. Implement a stack using an array Test your program on three different kinds of inputs: 1. String is unbalanced in the sense that there are more...
Evaluate the postfix expression shown below using a stack. Begin with an empty stack and show the contents of the stack after reading each token and indicate where “top” is. After reading all the tokens in the expression, the final result should be on the stack. 5 8 9 + * 7 4 * 5 3 2 * * + *
Java Evaluate whether the parentheses are balanced. { a * [ b - c ] / [ d + e ] a:closed parenthesis left on the stack b:none of these is correct c:open parenthesis left on the stack d:mismatch found when popping from the stack e:empty stack and no more tokens f:empty stack with no match for a close parenthesis ( a { b + c } + [ d * e ] - f ) / g ] a:empty...
Stacks and Java 1. Using Java 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. None of the built-in classes/methods/functions of Java can be used and must be user implemented. Practical application 1: Arithmetic operations. (a) Design an algorithm that takes a string, which represents an arithmetic...
ae two stacks, a number stack and an operator stack, to evaluate the tollowing algebraic expression (6+2*8/(16-4*3))/2 Read the items in the expression one at a time from left to right. Show the number stack and the operator stack after each item in the expression has been read and processed. If processing an item involves evaluating the top, show the two stacks af and then show the two stacks again after a "(” , if any, is popped off or...
a) Show the steps that a stack uses to convert the algebraic expression a*(b+c/d from infix to postfix notation. Indicate each intermediate change in the stack and postfix output. (Be sure to identify how operator precedence is determined. b) show the steps a stack uses to evaluate the postfix expression from part (a) when (a-6, b-4, c-2, d 5) c) Show the steps a stack uses to produce an expression tree with the postfix expression from part (a).
a) Show...
C++
Include a Stack class but DO NOT use STL stack, do not sumbit
code that is similar to
www.cplusplus.com/forum/beginner/192479/
Parenthesis Balance Problem Description Compilers require parenthesis, braces, brackets, and angled brackets to be balanced. This means that every time one is opened it must also be close AND everything between the two are also balanced. Balanced: (00) oO100) (C0O Unbalanced: (DI This is easily determined by creating a stack and reading the input. When an open parenthesis is found,...
Multiple choice data structures questions about stacks. Here is an INCORRECT pseudocode for the algorithm which is supposed to determine whether a sequence of parentheses is balanced: declare a character stack while ( more input is available) { read a character if ( the character is a '(' ) push it on the stack else if ( the character is a ')' and the stack is not empty ) pop a character off the stack else print "unbalanced" and exit...
(30 Points) Please compute the following postfix expression using stack as shown in your textbook (page 106-107). For every scan, you need to show your stack and indicate the top and bottom of the stack. 3. 3 7+2/2-48* +10+ (30 Points) Please convert the following infix expression to postfix expression using stack as shown in your textbook (page 109-110). For every scan, you need to show your stack and output. Also indicate the top and bottom of the stack. 4.
[3] In python, please help me write the functions needed for this problem: Another Way to do Parentheses: For this problem, you will be given a string that contains parentheses, brackets, and curly braces ( (, ), [, ], {,} ) and other characters. As a human you are given a string of any characters, determine if the parentheses, brackets, and braces match. (No trailing or leading parentheses). The function called on an empty string will return True. Parentheses must...