Skip to main content

2 docs tagged with "josephus"

View all tags

Josephus Problem Recursion

The Josephus problem is a theoretical problem related to a certain elimination game. It is often solved using recursion, where the goal is to determine the safe position in a group of people standing in a circle, eliminating every k-th person.

Josephus Queries Problem

In this post, we'll explore the Josephus Queries problem, where children are removed from a circle in a specific order. We will discuss the recursive approach to find out which child is removed at a given position and provide solutions in multiple languages such as C++, Java, Python, JavaScript, and Go. By the end, you'll understand how to efficiently determine the order of removals.