How can two algorithms
怎么可以两种算法
- one with
O(n²)
- the other with
Ω(n)
一个带O(n²)
另一个用Ω(n)
have the same practical run time, when testing the algorithms with a large number?
在测试大量算法时,是否具有相同的实际运行时间?
1 个解决方案
#1
O(f(n))
is a set of functions that grow proportionally to f(n)
or slower.
O(f(n))是一组与f(n)或更慢成比例增长的函数。
Ω(f(n))
is a set of functions that grow proportionally to f(n)
or faster.
Ω(f(n))是一组与f(n)或更快成比例增长的函数。
There are many functions that grow at least as fast as n
, but not faster than n^2
. For example: n
, n*log n
, n^1.5
, n^2
.
有许多函数的增长速度至少和n一样快,但不会快于n ^ 2。例如:n,n * log n,n ^ 1.5,n ^ 2。
#1
O(f(n))
is a set of functions that grow proportionally to f(n)
or slower.
O(f(n))是一组与f(n)或更慢成比例增长的函数。
Ω(f(n))
is a set of functions that grow proportionally to f(n)
or faster.
Ω(f(n))是一组与f(n)或更快成比例增长的函数。
There are many functions that grow at least as fast as n
, but not faster than n^2
. For example: n
, n*log n
, n^1.5
, n^2
.
有许多函数的增长速度至少和n一样快,但不会快于n ^ 2。例如:n,n * log n,n ^ 1.5,n ^ 2。