There is some bad news to be delivered, and X has taken on the dangerous mission. Nobody really wants to be the one to take the news; the way goes through enemy territory and, even if the messenger gets through, the classic fate of the bearer of bad news may be waiting. (Let's just say, this is how the phrase "Don't shoot the messenger" became relevant.) To determine which messenger will be sent, X sits all of his messengers down in a circle, selects a number, and starts to count off. Messengers are allowed to leave the circle one by one, and the last messenger left is the one who will deliver the bad news. The counting off procedure is slightly unusual, however, because it is actually the messenger after the last one counted who gets to leave the circle. Consider the following example with 5 messengers, in which the number selected for counting off is 7. We'll start at the "head" of the list and move forward. Since it is circular, the "head" simply refers to whatever the current element in the list is. We count off 7 messengers: Alice, autumn, Brad, Jon, Zach, Alice, and Autumn. Since autumn was the last one to count off, Brad (who would be next in the list) is declared "safe" and removed from the circle. We then count off 7 messengers again, starting with Jon (the next person in the list, since Brad was removed). The seven are Jon, Zach, Alice, Autumn, Jon, Zach, and Alice. Since Autumn is the next one in the list, she is declared safe and removed. Autumn was removed, so we now begin with Jon and count off as before. This time Zach is removed. We begin the counting with Alice, and Jon is removed. Since Alice is the last one left, she will be the messenger to take the bad news. Your mission: Implement a linked list in c++. The main function should implement the algorithm to choose the bearer of bad news. You should prompt the user for the "skip value," the number of messengers to skip before removing one from the list, and you should report to the user who the bad news bearer will be.

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
There is some bad news to be delivered, and X has taken on the dangerous mission. Nobody
really wants to be the one to take the news; the way goes through enemy territory and, even if
the messenger gets through, the classic fate of the bearer of bad news may be waiting. (Let's
just say, this is how the phrase "Don't shoot the messenger" became relevant.)
To determine which messenger will be sent, X sits all of his messengers down in a circle,
selects a number, and starts to count off. Messengers are allowed to leave the circle one by
one, and the last messenger left is the one who will deliver the bad news. The counting off
procedure is slightly unusual, however, because it is actually the messenger after the last one
counted who gets to leave the circle. Consider the following example with 5 messengers, in
which the number selected for counting off is 7.
We'll start at the "head" of the list and move forward. Since it is circular, the "head" simply
refers to whatever the current element in the list is. We count off 7 messengers: Alice,
autumn, Brad, Jon, Zach, Alice, and Autumn. Since autumn was the last one to count off,
Brad (who would be next in the list) is declared "safe" and removed from the circle. We then
count off 7 messengers again, starting with Jon (the next person in the list, since Brad was
removed). The seven are Jon, Zach, Alice, Autumn, Jon, Zach, and Alice. Since Autumn is the
next one in the list, she is declared safe and removed. Autumn was removed, so we now begin
with Jon and count off as before. This time Zach is removed. We begin the counting with
Alice, and Jon is removed. Since Alice is the last one left, she will be the messenger to take
the bad news.
Your mission:
Implement a linked list in c++.
The main function should implement the algorithm to choose the bearer of bad news. You
should prompt the user for the "skip value," the number of messengers to skip before
removing one from the list, and you should report to the user who the bad news bearer will be.
Transcribed Image Text:There is some bad news to be delivered, and X has taken on the dangerous mission. Nobody really wants to be the one to take the news; the way goes through enemy territory and, even if the messenger gets through, the classic fate of the bearer of bad news may be waiting. (Let's just say, this is how the phrase "Don't shoot the messenger" became relevant.) To determine which messenger will be sent, X sits all of his messengers down in a circle, selects a number, and starts to count off. Messengers are allowed to leave the circle one by one, and the last messenger left is the one who will deliver the bad news. The counting off procedure is slightly unusual, however, because it is actually the messenger after the last one counted who gets to leave the circle. Consider the following example with 5 messengers, in which the number selected for counting off is 7. We'll start at the "head" of the list and move forward. Since it is circular, the "head" simply refers to whatever the current element in the list is. We count off 7 messengers: Alice, autumn, Brad, Jon, Zach, Alice, and Autumn. Since autumn was the last one to count off, Brad (who would be next in the list) is declared "safe" and removed from the circle. We then count off 7 messengers again, starting with Jon (the next person in the list, since Brad was removed). The seven are Jon, Zach, Alice, Autumn, Jon, Zach, and Alice. Since Autumn is the next one in the list, she is declared safe and removed. Autumn was removed, so we now begin with Jon and count off as before. This time Zach is removed. We begin the counting with Alice, and Jon is removed. Since Alice is the last one left, she will be the messenger to take the bad news. Your mission: Implement a linked list in c++. The main function should implement the algorithm to choose the bearer of bad news. You should prompt the user for the "skip value," the number of messengers to skip before removing one from the list, and you should report to the user who the bad news bearer will be.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 1 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY