big-O表示法是做得最好,最坏的工具吗?算法的平均情况分析? [英] Is big-O notation a tool to do best, worst, & average case analysis of an algorithm?
问题描述
big-O表示法是一种可以做到最好,最坏和&的工具.算法的平均情况分析? 还是big-O仅用于最坏情况分析,因为它是一个上限函数?
Is big-O notation a tool to do best, worst, & average case analysis of an algorithm? Or is big-O only for worst case analysis, since it is an upper bounding function?
推荐答案
它是Big O,因为数量级表示为O(n),O(logN)等.
It is Big O, because orders of magnitude are expressed like O(n), O(logN), etc.
算法的最佳,最差和平均情况都可以用Big O表示法表示.
The best, worst, and average cases of an algorithm can all be expressed with Big O notation.
有关应用于排序算法的示例,请参见
For an example of this applied to sorting algorithms, see
http://en.wikipedia.org/wiki/Sorting_algorithm#Comparison_of_algorithms
请注意,可以根据多个独立的标准(例如内存使用或CPU使用)对算法进行分类.通常,需要在两个或多个条件之间进行权衡(例如,使用很少CPU的算法可能会占用大量内存).
Note that an algorithm can be classified according to multiple, independent criteria such as memory use or CPU use. Often, there is a tradeoff between two or more criteria (e.g. an algorithm that uses little CPU may use quite a bit of memory).
这篇关于big-O表示法是做得最好,最坏的工具吗?算法的平均情况分析?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!