edited by
394 views
1 votes
1 votes

edited by

1 Answer

0 votes
0 votes
else loop will be executed for (n-1) times

g(x) is also executed for (n-1) times as after every else g(x) should be executed. for better understanding draw the tree for some smaller input

again g(int m) function is executed for (1+logx) times

time complexity  wil be (n-1)(n-1)(1+logx) = O(n^2) where  (1+log x) can be omitted because of smaller value.

If I am wrong then plz correct me

Related questions

2 votes
2 votes
1 answer
1
thepeeyoosh asked Jan 11, 2018
1,048 views
1 votes
1 votes
1 answer
2
Kaluti asked Dec 6, 2017
727 views
3 votes
3 votes
2 answers
3
0 votes
0 votes
2 answers
4
rahul sharma 5 asked Dec 14, 2016
496 views
How is master theorem applicable here?