Algorithms icon indicating copy to clipboard operation
Algorithms copied to clipboard

Algorithms/AlgorithmsTest/src/Num1_1_04/Num_1_04_11.java

Open lutaoact opened this issue 7 years ago • 0 comments

howMany()方法,在最坏情况下,复杂度为O(n),如果一个数组的所有元素都是指定的可以,那循环就会执行n次。 我觉得正确的做法应该是,参考前一题,先找出最小索引,再找出最大索引,这两个操作都是对数级的复杂度,然后直接就能求出结果。

lutaoact avatar Jun 01 '17 13:06 lutaoact