Write an algorithm, using pseudo code, to perform one of the following tasks. “C
ID: 3631187 • Letter: W
Question
Write an algorithm, using pseudo code, to perform one of the following tasks.
“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
Explanation / Answer
Step1: Initialize N=1
Step2: While (N<=10)
2.1 Ask N persons which ice cream flavor you want
2.2 Read flavor
2.3 If flavor is available
2.4 Place order per person n+1
2.5 N=N+1
2.6 Else if flavor is not available
2.7 Your flavor is not available
2.8 Please select another flavor
2.9 goto Step 2.1
2.10 Else
2.11 No order place
2.12 N=N+1
Step 3: Stop
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.