Anton Sotnikov wrote:
yes, thanks it's work!
I can't do this code couple days - think i am not good.
By the way, what do you think about time coplexity of sorting algorithm:
it can be that:
Or there is another way?
The Time you tried to find using the Current time millies is not accurate, also you shouldn't call this as time complexity. Time Complexity is a mathematical definition to measure the performance of an algorithm. The Worst case performance in case of Insertion Sort is O(n^2) which is no good than Bubble or Selection sort but still its should be preferred over the latter two in the sense that the no. of comparisons made to sort the array is less.
If you wanna really measure the time taken to sort the list then use System.nanoTime() and make sure that all other application processes or windows are closed. Moreover This measurement differs from System to System and depends on your hardware specification.
If you wanna measure the time complexity then use Mathematical definition rather than currentTimeMillies()
Thank you.
Sincerely,
Psycho_Coder.