Useful Formulae
In this lesson, we'll discuss 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 is most likely in runtime.
-
Whenever you have a single nested loop, the problem is most likely in quadratic time.
Level up your interview prep. Join Educative to access 80+ hands-on prep courses.