Professional Documents
Culture Documents
Sukkur Institute of Business Administration: Data Structures and Applications
Sukkur Institute of Business Administration: Data Structures and Applications
Nahdia Majeed
For example, if there were six students, the elimination process would proceed as follows: 123456 12456 1245 125 15 1 Initial list of students; start counting from 1. Student 3 eliminated; continue counting from 4. Student 6 eliminated; continue counting from 1. Student 4 eliminated; continue counting from 5. Student 2 eliminated; continue counting from 5. Student 5 eliminated; 1 is the lucky winner.
Write a program that creates a circular linked list of nodes to determine which position you should stand in to win if there are n students. Your program should simulate the elimination process by deleting the node that corresponds to the student that is eliminated for each step in the process.