While processing this expression what is the hig
While processing this expression ( ( ) ( ) ( ( ) ( ) ) ) what is the highest number of elements on our stack at any one time? Answer with a whole number:
Solution
at any one time the maximum higesht elemnts can be 2.
For every ope brace the elemnet is pushed on to stack and when close brace is reached the element is poped from the tack
First element at 0-insert (
@1-insert (
@2 we encounter ) so pop and @1 no element
Next we encounter (so push to @1 and then )pop from position @1 and then ( we push element to postion @1
Then we have (we push to postion@2 then we encounter) so pop and then push and pop.
So at any point we have max 2elemnts
