algorithm - Sorting in java with minimum time complexity -


i new java have sort array of order 10^6. time complexity of sort method available in java. sorting algorithm should use?

assuming have no other knowledge of data , have use generic sort method, best theoretical in-place sort algorithm o(n*log(n)). arrays.sort method should using 1 of those, , best choice without more info.

if you're willing use lot of memory, can use non-in place sort such radix or counting. these can quicker n*log(n), quick o(n), may use o(n) or worse memory. if have knowledge of data having special properties (such being sorted) insertion sort or similar algorithms quicker o(n*log(n)) without using memory, without more info 1 of can't suggested.


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -