EvgenyKarkan / EKAlgorithms

EKAlgorithms contains some well known CS algorithms & data structures.
MIT License
2.42k stars 362 forks source link

Implementation of Josephus Problem (#36) #68

Closed stanislaw closed 10 years ago

stanislaw commented 10 years ago

This is a naive solution that uses "killer iterator" approach - this iterator kills elements by step of K, so when number of elements becomes less than K, these elements are survivors. More efficient implementation of this algorithm can exist - some math reasoning which yields direct math formula, but implementation of this will be another story.