Explore BrainMass

Algorithms Using Pseudo Code

This content was STOLEN from BrainMass.com - View the original, and get the already-completed solution here!

1. Write an algorithm, using pseudo code, "Word Search": Given a string of letters, identify all substrings that create one of five given words. For example, if the words (arguments) are: structure; such; system; blue; red, then the string jkdistructuredstrusyssystemoon contains the first, third and fifth words, once each.

2. Write an algorithm, using pseudo code, "Consensus algorithm": A group of ten people need to decide which one flavor of ice cream they will all order, out of three options. The algorithm can question and re-question the participants, and present the answers to the participants, until a consensus is reached. This exercise is somewhat more open-ended. Add your assumptions if necessary. Obviously, this algorithm might never result in an answer. Deal with that too.

© BrainMass Inc. brainmass.com October 24, 2018, 8:16 pm ad1c9bdddf

Solution Preview

Solution for 1st problem

Step 1: Initialize s to the string (which has string in it)
Step 2: Initialize Substr
Step 3: Initialize sLength to length of the string
Step 4: Store the words to search in an array
Step 5: Initialize arrofWords to words of search
Step 6: For I = 1 to ...

Solution Summary

Algorithms for a word search and a consensus are given in pseudo code.

See Also This Related BrainMass Solution

algothithm for calculating totals at a restaurant

Your goal is to solve the following simple logic exercise. You have been contracted by a local restaurant to design an algorithm determining the total meal charges. The algorithm should ask the user for the total food purchase and the tip percent. Then, the algorithm will calculate the amount of a tip, a 7% sales tax, and the total meal charge (including tip). The food purchase, sales tax, tip amount, and total meal charge will need to be displayed to the customer.
Be sure to THINK through the logic, then develop the IPO Chart using a Microsoft Word table. Develop the flow chart using Microsoft VISIO. Then write the pseudocode in Microsoft Word. The IPO table and the pseudocode may be included in one MS Word document

View Full Posting Details