+ 1
Time Complexity(O(n)) of this code
In order to know the algorithm efficiency of a code we use the (O(n)) function, better known as Time Complexity. What would the Time Complexity(O(n)) of this code be? https://code.sololearn.com/cCE49j2rbO9s/?ref=app
2 Antworten
+ 2
Its O(n^2) , as your code uses nested loops.
Basically time complexcity is measured by big 'Oh' notation or O() function .
O(n)-this represent a linear time complexcity.that means the time interval for execution of your code increases linearly with input provided.
O(n^2)- this represent a time complexcity that varies as a quadratic function of input provided.
0
kanishkaditya shukla Thank you for the explanation, I understand it much better now