Computers and Technology
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
}

answer
Answers: 3

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 04:30, ParallelUniverse
Which of the statements below is true? the formatting, standard, and drawing commands are unavailable. the formatting, standard, and drawing commands have been used. the formatting, standard, and drawing toolbars are displayed. the formatting, standard, and drawing toolbars are hidden.
Answers: 1
image
Computers and Technology, 22.06.2019 06:50, wtfcmd
Match the personality traits with their description
Answers: 1
image
Computers and Technology, 22.06.2019 10:00, kimmmmmmy333
According to alisa miller foreign news bureaus
Answers: 3
image
Computers and Technology, 22.06.2019 11:00, yentel110306
When building customer relationships through email what should you not do? question 2 options: utilize proper grammar, spelling, and punctuation type in all capital letters use hyperlinks rather than attachments respond to all emails within 24 hours
Answers: 1
Do you know the correct answer?
Here is an incorrect pseudo code for an algorithm which is supposed to determine whether a String of...

Questions in other subjects:

Konu
Mathematics, 18.01.2020 13:31
Konu
Spanish, 18.01.2020 13:31
Konu
Mathematics, 18.01.2020 13:31