For small input sizes (i.e. <= 1000), Programs in better algorithms don't mean they will take less time time to run. In such cases, O(N^2) may even run faster than O(n). You may only see big difference for a very large input sizes. From Wiki: --In mathematics, big O notation describes the limiting behavior of a function when the argument tends towards a particular value or infinity.--
【在 o*********r 的大作中提到】 : For small input sizes (i.e. <= 1000), Programs in better algorithms don't : mean they will take less time time to run. In such cases, O(N^2) may even : run : faster than O(n). You may only see big difference for a very large input : sizes. : From Wiki: : --In mathematics, big O notation describes the limiting behavior of a : function when the argument tends towards a particular value or infinity.--
f*1
6 楼
review
C*n
7 楼
那是,算法的速度还有常数项。 我在leetcode上验证的是同样速度级别的算法,比如O(N)= c1 N 和c2 N, 这里常数c1 明显比c2小得多的时候,c1 N 这个算法用的runtime还更大。
【在 o*********r 的大作中提到】 : For small input sizes (i.e. <= 1000), Programs in better algorithms don't : mean they will take less time time to run. In such cases, O(N^2) may even : run : faster than O(n). You may only see big difference for a very large input : sizes. : From Wiki: : --In mathematics, big O notation describes the limiting behavior of a : function when the argument tends towards a particular value or infinity.--
s*h
8 楼
claim review. ask reference to say that's major contributions also, so you can cite it in contribution section.
S*t
9 楼
不光是常数项,很多early termination or pruning技巧,runtime也跟test case有关
c1
【在 C*****n 的大作中提到】 : 那是,算法的速度还有常数项。 : 我在leetcode上验证的是同样速度级别的算法,比如O(N)= c1 N 和c2 N, 这里常数c1 : 明显比c2小得多的时候,c1 N 这个算法用的runtime还更大。