retagged by
259 views
0 votes
0 votes
I am not able to understand whether to add constant or not while forming recursive equation
retagged by

1 Answer

0 votes
0 votes
It totally depends on the type of complexity you are trying to find. let me explain this case wise.
 

In case if you are trying to find out the time complexity then you have to add the constant as even reading a single word would take some time.
If you are trying to find out the number of addition, multiplication or comparision in this case do check whether the respection operation is being performed in the also or not. if yes them add the number of times that operation is performed but generally we add constant.
In case of value you need to be bit careful with the constant, for that i would suggest you to practice some examples.

Hope this helps.

Related questions

1 votes
1 votes
0 answers
1
syncronizing asked Mar 15, 2019
1,253 views
Is this the correct way to solve ?Q) int algorithm(int n){ int sum =0;k,j; for (k=0;k<n/2;k++) for(j=0;j<10;j++) sum++; return 4*algorithm(n/2)*algorit...
1 votes
1 votes
1 answer
2
VikramRB asked Jan 20, 2019
1,005 views
What is the time complexity of the following recurrence relation and step to derive the same$T(n) = T(\sqrt{n}) + log(logn)$
0 votes
0 votes
0 answers
4
garvit_vijai asked Nov 17, 2018
449 views
How to solve the following recurrence relation?T(n) = T(n-6) + n2 , n>7T(n) = 1 , n<= 7