Computer Science, asked by cskamalsaini, 3 months ago

Consider the process of balancing symbols using stack. What characters will be pushed into the stack?

A.Operators
B. Elements in the expression
C.Open brackets
D. Closing brackets​

Answers

Answered by Anonymous
5

Answer:

How can stacks be used for checking balancing of symbols?

If the character read is not a symbol to be balanced, ignore it.

If the character is an opening delimiter like ( , { or [ , PUSH it into the stack.

If it is a closing symbol like ) , } , ] , then if the stack is empty report an error, otherwise POP the stack.

Answered by aditijaink283
0

Answer:

The answer to the given question is:

C. Open brackets

Explanation:

Stacks are utilized when there is a lengthy-expression to be analyzed with multiple brackets to direct us as to which operations should be performed first.

Stacks now work on the last in first out principle, which means that only the pieces at the end of a stack can pop out. For example, in a stack of books, you can only extract the book at the top.

This concept is used in brackets matching, in which opening parentheses are pushed into the stack & closing parentheses are popped out; if all of the parentheses are covered and our stack is empty, we claim that bracket matching was successful.

#SPJ2

Similar questions