subject
Computers and Technology, 05.05.2020 05:05 sggg497

Here is an incorrect pseudo code for an algorithm which is supposed to determine whether a String of parentheses is balanced: Give an example of an input string that is made up of only the characters '('and ')', is unbalanced, but for which this algorithm will returin true.
1. Explain what is wrong with the algorithm. Can this algorithm ever incorrectly return false when its input string is a balanced string?
boolean isBlanced( String input )
{
declare a character stack
while ( input has more characters )
{
read a character from input
if (the character is a'(')
push it on the stack
else if (the stack is not empty)
pop a character off the stack
else
return false
}
return true
}

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 18:00
Budgets you to do all of the following expect a) send frivolously b) avoid over spending c) gain financial independence d) examine your priorities and goals
Answers: 2
question
Computers and Technology, 23.06.2019 04:31
Q14 what is most important for you to choose before you build a network? a. private network b. nos c. network media d. network protocol e. directory service
Answers: 1
question
Computers and Technology, 23.06.2019 09:30
After you present a proposal, the committee starts asking you questions, some beyond the strict focus of your proposal. they ask questions about implications in other fields and knowledge about other fields. you are asked to redo your proposal. what is most likely missing? breadth of material depth of material clarity of material details of material
Answers: 1
question
Computers and Technology, 24.06.2019 08:00
How can smart devices benefit businesses, organizations, and social communities in the global marketplace?
Answers: 1
You know the right answer?
Here is an incorrect pseudo code for an algorithm which is supposed to determine whether a String of...
Questions
question
Mathematics, 15.06.2021 16:20