An algorithm is said to be of polynomial time if its running time is upper bounded by a polynomial expression in the size of the input for the algorithm, that is, for some positive constant
如果一个算法复杂度小于某个多项式,那么这个算法就是多项式时间算法
或者说,当大于某个
后,
小于等于
,
和
都是某个正整数:
举例
- 二分查找复杂度
,所以它是多项式时间算法
- 快速排序平均复杂度
,最坏复杂度
(有什么算法平均时间复杂度是多项式的而最坏复杂度不是多项式的吗?如果没有那一般看平均时间复杂度就行?)