In this program we will write a small game using link list:

  • Your program should ask the user to enter one alphabet letter at a time, and each letter should be stored in a node. Choose a terminate character if the user want to stop.
  • Next, you will ask the user for an integer n as your count number.
  • The game will go like this, starting from the first letter, you program will count and eliminate e very “nth” letter. For example, if n = 3; starting from the first letter, you will count 3 letter down the line and eliminate it. Then continue, if we reach the last letter we would continue counting from the beginning.
  • Announce the last surviving letter.

Program structure:

  • Your program should utilize a link list. You need to insert a new node for each new character after the previous character (so this is not a head insert).
  • The eliminated character should be removed from your link list.
ABCDEF - starting from A.
ABDEF - count 3 to C, C is eliminated. Continue from D.
ABDE - count 3 to F, F is eliminated. Continue from A. (since A is the next letter if you imagine this is a circular pattern).
ABE - count 3 to D, D is eliminated. Continue from E.
AE - count 3 to B, B is eliminated. Continue from E.
A - count 3 to E, E is eliminated. A is the last surviving letter.
Academic Honesty!
It is not our intention to break the school's academic policy. Projects posted are only used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly fill out the form. Please provide a valid email address and we'll get back to you in less than 24 hours. We will be sending an invoice through PayPal upon confirmation. We are a non profit organization however we need an amount to keep this organization running, and to be able to complete our research and development.