0
7.2kviews
What is time complexity? Determine the time complexity of the following code

Please find the code snippet below

for(i=1; i<=n; i++)

for(j=1; j<=n; j++) x=x+1
2 Answers
3
161views

The amount of time taken by an algorithm to run as a function is known as time complexity. It measures the time taken to execute each statement of code in an algorithm. It is calculated by counting the number of basic steps taken by any algorithm to complete execution. The …

Create a free account to keep reading this post.

and 5 others joined a min ago.

1
122views

There can be many algorithms(ways) to solve a problem and every solution we obtain from all the ways is the same. So, to decide on which algorithm to use or to choose the way to apply for a problem ,time complexity comes into picture.

Time Complexity : It is the …

Create a free account to keep reading this post.

and 3 others joined a min ago.

Please log in to add an answer.