Tagged Questions
-1
votes
0answers
89 views
Time complexity (in big-O notation) of the following recursive code? [closed]
public static int abc(int n) {
if (n <= 2) return n;
int sum = 0;
for (int j=1; j<n; j *= 2)
sum += j;
for (int k=n; k>1; k /= 2)
sum += k;
return abc(n ...
15
votes
6answers
2k views
How do I determine the runtime of a double recursive function?
Given any arbitrarily double-recursive function, how would one calculate its run time?
For Example (in pseudocode):
int a(int x){
if (x < = 0)
return 1010;
else
return b(x-1) + ...