Time Complexity - Part 1 - Java
Time Complexity - Part 1 - Java
Time Complexity - Part 1 - Java
Part 1
Hira Awais
Lecturer (DCS)
DDSA (FOC)
Slide courtesy : Dr. Zahid Halim
• Finite sequence of instructions.
1,2,8: Once
3,4,5,6,7: Once per each iteration
of for loop, N iteration
Total: 5N + 3
The complexity function of the
algorithm is : f(N) = 5N +3
Estimated running time for different values of N:
N = 10 => 53 steps
N = 100 => 503 steps
N = 1,000 => 5003 steps
N = 1,000,000 => 5,000,003 steps