Powered By Blogger

Monday 18 April 2011

cs301 solution 1



Write a C++ program to solve the Josephus problem for general values of m and n using circular linked list data structure.


Input:
  • Number of People: n
  • Number of Passes: m
Output:
  • Order in which people are removed
  • The survivor

Sample Run:
Enter total number of People playing the game: 10
Enter number of Passes: 3
----------------------------------------------------
Game Started!
----------------------------------------------------
à Person removed: 4
à Person removed: 8
à Person removed: 2
à Person removed: 7
à Person removed: 3
à Person removed: 10
à Person removed: 9
à Person removed: 1
à Person removed: 6
----------------------------------------------------
ààà The survivor is : 5
----------------------------------------------------

3 comments:

  1. Solution day dooo bhai !!!!!!!

    ReplyDelete
  2. where is solution ??????

    ReplyDelete
  3. ye kia bakwas hay yar koi solution tao hay nahin yahan.

    ReplyDelete