Sunday 24 September 2017

Time Complexity analysis


A program with time complexity 0.01*n2 is more complex than the program with time complexity 1600*n
For ex: Let n=1,000,000
0.01*n2 = 0.01*1,000,000*1,000,000 =10,000,000,000
1600*n  = 1600*1,000,000=1,600,000,000
Hence for larger values of n, a program with time complexity 0.01*n2 is more complex than the program with time complexity 1600*n  
Time complexity of 0.01*n2 +1600*n  would be O(n2)

No comments:

Post a Comment