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, 23.06.2019 03:50
Iam a bacterium. i cause stomach cramps and diarrhea. i am caused by eating rotten foodssuch as chicken, fish, or eggs. sometimes turtles carry my bacteria.what am i?
Answers: 2
question
Computers and Technology, 23.06.2019 11:00
Describe three characteristics of at-risk drivers. a. b. c. describe three characteristics of safe drivers. a. b. c. describe three driver errors that could cause a collision. a. b. c. how will this information affect you as a driver now and in the future? (2-3 sentences)
Answers: 2
question
Computers and Technology, 23.06.2019 17:00
*! 20 points! *jeff wants to create a website with interactive and dynamic content. which programming language will he use? a. dhtml b. html c. css d. javascript
Answers: 1
question
Computers and Technology, 24.06.2019 15:30
What type of forensic evidence was recovered during the bomb set off at the new mexico facility on the video that was similar to the evidence obtained at the boston bombings and how did the evidence allow the researchers to connect other pieces of evidence to the same bomb?
Answers: 2
You know the right answer?
Consider the algorithm for determining whether a sequence of parentheses is balanced (has correct ne...
Questions
question
English, 17.07.2021 01:00
Questions on the website: 13722367