Useful Formulae
In this lesson, we'll study some mathematical formulae that would make calculating time complexity easier!
We'll cover the following
Formulae
Here is a list of handy formulas which can be helpful when calculating the Time Complexity of an algorithm:
General Tips
- Every time a list or array gets iterated over times, it is most likely in time.
- When you see a problem where the number of elements in the problem space gets halved each time, it will most probably be in runtime.
- Whenever you have a single nested loop, the problem is most likely in quadratic time.
In the next lesson, we will discuss some common scenarios and how you can calculate their complexities.
Level up your interview prep. Join Educative to access 80+ hands-on prep courses.