11,144 views

4 Answers

Best answer
44 44 votes
STACK scan the expression from left to right whenever a left paranthesis is encountered just PUSH it into stack and whenever a right paranthesis is encountered just POP it from stack. If at the end of expression we are left with an empty stack then it is a correctly parenthesized expression.
• edited by
7 7 votes

this might Help you

6 6 votes
Example of Stack

7  -  (   (  x  *  (  (  x  +  y  )  / (  j  -  3   )  )  +  y   )  /  (  4  -  2.5  )  )
0 0  1  2 2 2  3 4 4  4  4 3 3 4 4 4 4  3  2 2  2  1 1  2 2  2   2  1 0

Eventually we get 0 in stack
Answer:
Position:
Show:

Related questions

64 64 votes
7 answers 7 answers
48.0k
48.0k views
Kathleen asked Sep 18, 2014
47,952 views
A single array $A[1 \ldots \text{MAXSIZE}]$ is used to implement two stacks. The two stacks grow from opposite ends of the array. Variables $top1$ and $top2$ $(top1 < top...
37 37 votes
3 answers 3 answers
9.8k
9.8k views
Kathleen asked Sep 18, 2014
9,760 views
The elements $32, 15, 20, 30, 12, 25, 16,$ are inserted one by one in the given order into a maxHeap. The resultant maxHeap is
32 32 votes
5 answers 5 answers
13.8k
13.8k views
Kathleen asked Sep 18, 2014
13,813 views
Given the following input $(4322, 1334, 1471, 9679, 1989, 6171, 6173, 4199)$ and the hash function $x$ mod $10$, which of the following statements are true?$9679, 1989, 4...
31 31 votes
3 answers 3 answers
10.4k
10.4k views
Kathleen asked Sep 18, 2014
10,360 views
Level order traversal of a rooted tree can be done by starting from the root and performingpreorder traversalin-order traversaldepth first searchbreadth first search