What is the time complexity of the program for the sum of two numbers ?
Step count method
void main()
{
int a,b,c; //----------0
a=10; //----------1
b=20; //----------1
c=a+b; //----------1
}
f(n) = 0+1+1+1 = 3
Related Posts:
What is the time complexity of, f(n)= n3+n2+n+4What is the time complexity of given function,f(n)= n3+n2+n+4 ?Solution:Given,f(n)= n3+n2+n+4f(n) >= n3+n2+n+4 f(n) >=&… Read More
What is the time complexity of, f(n)= 5n2+3n+4What is the time complexity of given function,f(n)= 5n2+3n+4 ?Solution: Given, f(n)=5n2 +3n+4 5n2 +3n+4>=5n2 +3n+4 fo… Read More
What is the time complexity of, f(n)= n+4What is the time complexity of given function? f(n)=n+4.Solution:Given,f(n)=n+4 n+4 >= n+4n+4 >= n, where n >= 1n+4 >= n, for al… Read More
Find the time complexity of sum of two numbersWhat is the time complexity of the program for the sum of two numbers ?Step count methodvoid main() {int a,b,c; //----------0a=10;… Read More
Find the time complexity of sum of two numbers using functionWhat is the time complexity of the program for the sum of two numbers using function ?Step count methodint sum() {int a,b,c; //&nb… Read More
Find the time complexity of sum of two matricesWhat is the time complexity of the program for the sum of two matrices?Step count methodvoid sum(){int n, a[n][n],b[n][n],c[n][n],i,j;&… Read More
Post a Comment
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.