目录
当前位置: 首页 > 文档资料 > C/C++ 语言参考 >

Complexity

优质
小牛编辑
127浏览
2023-12-01

Complexity

There are different measurements of the speed of any given algorithm. Given an input size of N, they can be described as follows:

NameSpeedDescription
exponential timeslowtakes an amount of time proportional to a constant raised to theNth power (K^N)
polynomial timefasttakes an amount of time proportional toN raised to some constant power (N^K)
linear timefastertakes an amount of time directly proportional toN (K *N)
logarithmic timemuch fastertakes an amount of time proportional to the logarithm ofN (log(N))
constant timefastesttakes a fixed amount of time, no matter how large the input is (K)