Hi would like to know that my algorithm has asymptotic complexity recursive?
regards
cronos
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
|
int solve(pair<int,int> actual)
{
if(actual.first == PuntoInicio.first && actual.second == PuntoInicio.second)
return 1;
if(actual.first < PuntoInicio.first || actual.second < PuntoInicio.second)
return 0;
pair < int,int > p1, p2, p3;
p1.first = actual.first - 1;
p1.second = actual.second;
p2.first = actual.first;
p2.second = actual.second - 1;
p3.first = actual.first - 1;
p3.second = actual.second - 1;
return solve(p1) + solve(p2) + solve(p3);
}
|
Last edited on