The Running Time For Arrays.Sort Method in Java

前端 未结 2 1348
我寻月下人不归
我寻月下人不归 2020-12-19 02:40

Does anyone know the running time in big O notation for the arrays.sort java method? I need this for my science fair project.

2条回答
  •  一整个雨季
    2020-12-19 02:52

    Arrays.sort() uses Tim sort - O(N log N) for array of objects and QuickSort for arrays of primitives - again O(N log N).

    Here is an awesome comparison of sorting algorithms: http://www.sorting-algorithms.com/

提交回复
热议问题