What is the time complexity of the program for the sum of two numbers using function ?
Step count method
int sum()
{
int a,b,c; // —-0
a=10; //—-1
b=20; //—-1
c=a+b; //—-1
return c; //—-1
}
f(n) = 0+1+1+1+1 = 4
f(n) = O(1)
Ask a study question in English or Hindi. I will find relevant passages from our notes.