subject

Consider the algorithm for determining whether a sequence of parentheses is balanced (has correct nesting). The pseudo code for this algorithm appears below. Initialize a boolean variable validExpression to true.
while (there are more symbols in the expression){

look at the next symbol
if symbol is a {, [, or (
push it on the stack
if it is a }, ], or ){ if the stack is empty then return false
else pop the stack
}

if the element popped is not the match for symbol then return false
}
if the stack is not empty then return false, else return true.

Required:
What is the maximum number of symbols that will appear on the stack at any time for the sequence { [ ( ) ] [ ( ) ] [ ( ) ] }? why?

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 20:00
Which type of file can be used to import data into a spreadsheet?
Answers: 1
question
Computers and Technology, 23.06.2019 11:00
What is the name of the sound effect that danny hears
Answers: 1
question
Computers and Technology, 23.06.2019 14:00
Need ! will choose brainliest! discuss the role of abstraction in the history of computer software.
Answers: 1
question
Computers and Technology, 24.06.2019 09:30
What is the definition of digital literacy?
Answers: 1
You know the right answer?
Consider the algorithm for determining whether a sequence of parentheses is balanced (has correct ne...
Questions
question
Mathematics, 07.04.2020 23:55