插入排序的总括声明是什么?
What is the blanket statement for insertion sort?
对于每个输入'n'我们可以说插入排序的上限是O(n^2)而下限是omega(n)吗?或者它只是 O(n^2)?
对于每个输入,时间复杂度为 O(n^2)+Omega(n)=O(n^2)
,因为 Omega(n) = O(n^2)
。注意事项that
Note that "=" is not meant to express "is equal to" in its normal mathematical sense, but rather a more colloquial "is"
对于你问题的第二部分,这取决于你对哪种类型的下限感兴趣。
Omega(n) in the best case so the lower bound is at least Omega(n)
如果您想要所有输入的下限,那么可以。考虑最佳输入会给你下限。如果您想要解决相同问题的任何算法的下限,您需要考虑所有可能输入的算法。
对于每个输入'n'我们可以说插入排序的上限是O(n^2)而下限是omega(n)吗?或者它只是 O(n^2)?
对于每个输入,时间复杂度为 O(n^2)+Omega(n)=O(n^2)
,因为 Omega(n) = O(n^2)
。注意事项that
Note that "=" is not meant to express "is equal to" in its normal mathematical sense, but rather a more colloquial "is"
对于你问题的第二部分,这取决于你对哪种类型的下限感兴趣。
Omega(n) in the best case so the lower bound is at least Omega(n)
如果您想要所有输入的下限,那么可以。考虑最佳输入会给你下限。如果您想要解决相同问题的任何算法的下限,您需要考虑所有可能输入的算法。