What is the maximum number of parenthesis that will appear on the stack at any one time for parenthesis expression given by
$( ( ) \; ( ( ) ) \; ( ( ) ) )$
Show the worked solutionPush on '(' and pop on ')'. Stack size after each symbol of \((\,(\,)\,(\,(\,)\,)\,(\,(\,)\,)\,)\):\[1,\ 2,\ 1,\ 2,\ 3,\ 2,\ 1,\ 2,\ 3,\ 2,\ 1,\ 0.\]The maximum, reached inside each inner \((\,(\,)\,)\) group, is 3, which is the nesting depth.Answer: B
GATE DA practice: past exam problems by chapter, with worked solutions · gatedaprep.com