This is the extended Josephus problem. More details and solution
formulation here:
http://www.cs.man.ac.uk/~shamsbaa/Josephus.pdf


On Jul 26, 11:04 pm, Nikhil Gupta <[email protected]> wrote:
> Please suggest a good algo for this :
>
> You have numbers 1 to n (consider them arranged in a circular order)
> Then starting from the first number, all alternate numbers are deleted. Once
> the entire range is traversed with this procedure, the same is performed
> from the beginning again (as they are circularly arranged).
> This action is done until only one number is left. So given a range of
> numbers, you have to use an algo to tell which number will be left in the
> end.
>
> Example :
>
> 1 2 3 4 5 6 7 8 9 10 11 12 .......
> 1 3 5 7 9 11 13 15 17 19 .....
> 1 5 9 13 17 21 25 .....
>
> and so on.
>
> --
> Nikhil Gupta
> Senior Co-ordinator, Publicity
> CSI, NSIT Students' Branch
> NSIT, New Delhi, India

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to