HarshCasper / NeoAlgo

Bringing all Data Structures and Algorithms under one Roof âš¡
MIT License
875 stars 1.05k forks source link

Josephus Problem #2582

Closed pshivesh8 closed 3 years ago

pshivesh8 commented 3 years ago

🚀 Feature

Josephus problem

Problem Statement: People are standing in a circle waiting to be executed. Counting begins at a specified point in the circle and proceeds around the circle in a specified direction. After a specified number of people are skipped, the next person is executed. The procedure is repeated with the remaining people, starting with the next person, going in the same direction, and skipping the same number of people, until only one person remains, and is freed.

The problem: given the number of people, starting point, direction, and number to be skipped — is to choose the position in the initial circle to avoid execution.

Have you read the Contributing Guidelines on Pull Requests?

Yes

Motivation

I will solve this using recursion which is a very important topic in DSA.

Pitch

I will solve this in C++ using a recursive approach.

Hey, @bhav09 please look into this issue and please assign it to me.

bhav09 commented 3 years ago

Is it for GSSoC'21? @pshivesh8

pshivesh8 commented 3 years ago

Yes @bhav09 , it is for GSSoC'21

bhav09 commented 3 years ago

Okay, thanks. I am assigning it to you.