小编Buc*_*cky的帖子

数组的时间复杂度是多少,sort(String [])

String str[] = {"Hello", "World", "John", "Doe"};
Arrays.sort(str);
System.out.prinltn(Arrays.toString(str));
Run Code Online (Sandbox Code Playgroud)

我知道 Arrays.sort(int[]) 的时间复杂度为 O(nlgn)。但是字符串数组呢。由于排序字符串数组在内部使用 compareTo 函数来比较两个字符串。它会改变等式吗?

java arrays string time time-complexity

2
推荐指数
1
解决办法
757
查看次数

标签 统计

arrays ×1

java ×1

string ×1

time ×1

time-complexity ×1