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 03:00
How can i clip a picture to a question on the computer?
Answers: 1
question
Computers and Technology, 23.06.2019 04:31
This graph compares the cost of room and board at educational institutions in texas.
Answers: 1
question
Computers and Technology, 24.06.2019 11:00
Each row in a database is a set of unique information called a(n) ? a.) table. b.) record. c.) object. d.) field.
Answers: 2
question
Computers and Technology, 24.06.2019 13:00
Ais a built in formula in spread spread a is any math process such as addition or subtraction. options are function and operation
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, 31.01.2020 17:04
question
Health, 31.01.2020 17:04
question
Mathematics, 31.01.2020 17:04
question
Mathematics, 31.01.2020 17:04
Questions on the website: 13722361