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, 23.06.2019 07:30
What part of the interface displays the external references contained in a selected cell? the status bar the review tab the scroll bar the formula bar
Answers: 1
question
Computers and Technology, 24.06.2019 02:30
Assume a class window with accessor method getwidth that accepts no parameters and returns an integer. assume further an array of 3 window elements named winarr, has been declared and initialized. write a sequence of statements that prints out the width of the widest window in the array.
Answers: 2
question
Computers and Technology, 24.06.2019 12:30
Select all that apply. what two keys listed below should you use to enter data in an excel worksheet? tab backspace enter right arrow
Answers: 2
question
Computers and Technology, 25.06.2019 01:30
The study of how to design software, solve problems such as computer security threats, or come up with better ways of handling data storage
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, 21.06.2021 14:00
question
Social Studies, 21.06.2021 14:00
question
Mathematics, 21.06.2021 14:00
Questions on the website: 13722363