Photo by Goran Ivos on Unsplash

Time Complexity and Its Importance in Python

Kaushik Katari
The Startup
8 min readJul 27, 2020

--

Now-a-days, for one problem we can write the solution in n number of ways, but, how can we decide which type is better. We can use different types of algorithms to solve one problem. We need to compare these algorithms and have to choose the best one to solve the problem.

But what is an algorithm?

An algorithm is a set of instructions, which are created to get the required output. Many different algorithms can give same output.

To perform these instructions a computer should have memory, and it also requires time to perform those actions.

What is Time Complexity?

The amount of time it takes to run the program and perform the functions in it is known as Time Complexity. By using Time Complexity we can determine whether the program is efficient or we have to use another algorithm which take less time compared to the other one.

Reducing Time Complexity of an algorithm is often difficult in Data Science, rather than difficult we can say its a bigger challenge.

We will tell the time complexity of a program by calculating the time taken to run the algorithm in the worst-case scenario.

To quantify the Time Complexity, we will use Big-O notation.

--

--

Kaushik Katari
The Startup

Software Engineer | Python | Machine Learning | Writer