Bad News Bearers Introduction 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

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Bad News Bearers

Introduction

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.

Bad News Bearers
Introduction
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.
Transcribed Image Text:Bad News Bearers Introduction 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: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
steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Topological Sort
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education