thuva4 / Algorithms

Collection of algorithms in multiple programming languages.
https://thuva4.github.io/Algorithms/
Apache License 2.0
486 stars 545 forks source link

C++ implementation of Josephus problem #913

Closed KunalKartik02 closed 1 year ago

KunalKartik02 commented 1 year ago

C++ implementation of the Josephus problem. Problem statement - Consider a game where there are n children (numbered 1,2,…,n) in a circle. During the game, every second child is removed from the circle, until there are no children left. In which order will the children be removed?

This is a very important and standard problem in the world of algorithms. Helps to improve implementation and mathematical skills.