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 17:30
The forerunner to cell phones, pdas, and smartphones was
Answers: 1
question
Computers and Technology, 23.06.2019 00:30
Which one of the following is considered a peripheral? a software b mouse c usb connector d motherboard
Answers: 2
question
Computers and Technology, 23.06.2019 16:30
Monica and her team have implemented is successfully in an organization. what factor leads to successful is implementation? good between different departments in an organization leads to successful is implementation.
Answers: 1
question
Computers and Technology, 24.06.2019 13:20
3. ranga ramasesh is the operations manager for a firm that is trying to decide which one of four countries it should research for possible outsourcing providers. the first step is to select a country based on cultural risk factors, which are critical to eventual business success with the provider. ranga has reviewed outsourcing provider directories and found that the four countries in the table that follows have an ample number of providers from which they can choose. to aid in the country selection step, he has enlisted the aid of a cultural expert, john wang, who has provided ratings of the various criteria in the table. the resulting ratings are on a 1 to 10 scale, where 1 is a low risk and 10 is a high risk. john has also determined six criteria weightins: trust, with a weight of 0.3; quality, with 0.2; religious, with 0.1; individualism, with 0.2; time, with 0.1; and uncertainity, with 0.1. using the factor-rating method, which country should ranga select? why? (2 points)
Answers: 3
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, 29.09.2020 07:01
question
Mathematics, 29.09.2020 07:01
question
Mathematics, 29.09.2020 07:01
Questions on the website: 13722360