Useful Formulas
In this lesson, we'll study some mathematical formulas that make calculating time complexity easier!
We'll cover the following
Formulas
Here is a list of handy formulas which can be helpful when calculating the time complexity of an algorithm:
Summation | Equation |
---|---|
Some of the formulas dealing with logarithmic expressions:
Logrithmtic expressions | Equivalent expression |
---|---|
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, that will most probably be in runtime.
- Whenever you have a singly nested loop, the problem is most likely in quadratic time.
Level up your interview prep. Join Educative to access 80+ hands-on prep courses.