我已经阅读了有关Big-O复杂性顺序的内容。在互联网上它说订单是:
O(1)< O(log n)< O(n)< O(n log n)< O(n ^ 2)< O(n ^ 3)< O(2 ^ n)< Ø (10 ^ n)的
现在我想按照从最低到最高的复杂度顺序对这些O-Notations进行排序。
a: O(π^e n^2)
b: O(n+n^2/√n^3)
c: O((1/10^100)n!+5n^2)
d: O(25√9n)
e: O(log(n^n)
订单e,d,a,b是否正确?我不确定c属于哪里。
答案 0 :(得分:1)
首先,请注意从数学上讲,我从来没有听说过O运算符图像上的正确定义的顺序关系,所以当你说.sv:"timestamp"
时,据我所知它没有数学定义,只表示复杂度为O(1) < O(log n)
的算法(对于大问题)比复杂度为O(1)
的算法慢。
现在回答你的问题,让我们简化所有表达式:
O(n)
现在很明显,&#34;顺序&#34;,从更快到更慢,将是:a: O(π^e n^2) <=> O(n^2) (a constant factor doesn't affect the nature of complexity itself although it will impact running time)
b: O(n+n^2/√n^3) <=> O(n^2/√n^3) (eliminating a term that evolves slower than the other term)
<=> O(√n) (simplifying expression)
c: O((1/10^100)n!+5n^2) <=> O(n!) (eliminating a term that evolves slower than the other term and removing constant factors)
d: O(25√9n) <=> O(n) (removing constant factors)
e: O(log(n^n)) <=> O(n log(n)) (simplifying expression)