Assignment - Josephus Problem - Linked Lists
Objectives:
· Fully implement an linked list from scratch
· Show understanding of using algorithms of a linked list
· Dynamic allocation
· Deletion
· Etc.
· Use Object Oriented skills to create a templated linked list class
Outcomes:
· Understand structured programming techniques in-depth.
· To learn data abstraction and object-oriented programming.
· To learn the fundamental data structures including stacks, queues, linked lists, and trees.
· To obtain a good foundation for further study in computer science.
Description:
Josephus Problem "There are people standing in a circle waiting to be executed. After the first man is executed, certain number of people are skipped and one man is executed. Then again, people are skipped and a man is executed. The elimination proceeds around the circle (which is becoming smaller and smaller as the executed people are removed), until only the last man remains, who is given freedom.
The task is to choose the place in the initial circle so that you survive (are the last one remaining)." -- Wikipedia, http://en.wikipedia.org/wiki/Josephus_problem
Assume that the number of people, P, in the circle may be any number between zero and one hundred.
Assume that every Nth person around the circle is killed each turn, where N is an integer between one and twenty.
Specifications:
· Create an application in C++ that uses a linked list to represent the circle of people, numbered from 1 to P.
· Acquire the values P and N from the user at runtime via console input.
· Output the the individual that survives the mass execution.
Flash Version
· http://webspace.ship.edu/deensley/flash/JosephusProblem.html
There are several Java applet versions of this problem to check your work as you debug.
· http://www.wou.edu/~burtonl/josephus.html
· This applet lets you choose how many people are in the circle and tells you who survives if every n die