0
What is the order of growth of time complexity of this method?
I'm learning java and I came across this term and simply still dont understand the concept. So what is time complexity and how do a calculate it? https://code.sololearn.com/c345RgHQpYit/?ref=app
5 ответов
+ 2
So you know what time complexity is and want to know the time complexity of your code? I'd say O(n^2) because the whole list of numbers has to be iterated over with one nested loop, so there are length * length steps.
https://en.m.wikipedia.org/wiki/Time_complexity
0
I'm not sure but I think time complexity means the time for performing an action (for instance sorting an array).
0
Théophile yeah I know that part. Just dont know how to calculate it
0
Just store in a variable a the actual time at the beginning of your program. Then, at the end, take again the actual time and subtract it the number store in variable a
0
Function to get actual time, in millisecond, is System.currentTimeMillis()