MCPcopy Create free account
hub / github.com/codemistic/Data-Structures-and-Algorithms / Josh

Function Josh

CPP/recursion/JosephusProblem.cpp:5–14  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3using namespace std;
4
5void Josh(vector<int> person, int k, int index)
6{
7 if (person.size() == 1) {
8 cout << person[0] << endl;
9 return;
10 }
11 index = ((index + k) % person.size());
12 person.erase(person.begin() + index);
13 Josh(person, k, index);
14}
15
16int main()
17{

Callers 1

mainFunction · 0.85

Calls 1

sizeMethod · 0.45

Tested by

no test coverage detected