- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
据我所知和研究,
Big - Oh notation describes the worst case of an algorithm time complexity.
Big - Omega notation describes the best case of an algorithm time complexity.
Big - Theta notation describes the average case of an algorithm time complexity.
然而,最近几天,我看到有人在讨论中说
O for worst case is a "forgivable" misconception. Θ for best is plainwrong. Ω for best is also forgivable. But they remain misconceptions.
The big-O notation can represent any complexity. In fact it candescribe the asymptotic behavior of any function.
我还记得我在大学类(class)中学过前一个。我还是个学生,如果我认识错了,请你解释一下好吗?
最佳答案
Bachmann-Landau 表示法与算法的计算复杂性完全无关。这应该已经很明显了,因为在 1894 年巴赫曼和朗道发明了这种表示法时,计算算法的计算机器的想法并不真正存在。
Bachmann-Landau 表示法通过将函数分组到以大致相同的速率增长的函数集中来描述函数的增长率。 Bachmann-Landau 符号没有说明这些函数的含义。它们只是函数。事实上,它们根本不需要任何意义。
他们的意思是:
它没有说明 f 或 g 是什么,也没有说明它们的含义。
请注意,实际上有两个 Ω 的相互冲突、不兼容的定义;这里给出的是对计算复杂性理论更有用的一种。另请注意,这些只是非常广泛的直觉,如有疑问,您应该查看定义。
如果需要,您可以使用 Bachmann-Landau 表示法将兔子数量的增长率描述为时间的函数,或者将人类腹部的增长率描述为啤酒的函数。
或者,您可以用它来描述最佳情况步骤复杂度、最坏情况步骤复杂度、平均情况步骤复杂度、预期情况步骤复杂度、摊销步骤复杂度、最佳情况时间复杂度、最坏情况时间算法的复杂度、平均情况时间复杂度、预期情况时间复杂度、摊销时间复杂度、最佳情况空间复杂度、最坏情况空间复杂度、平均情况空间复杂度、预期情况空间复杂度或摊销空间复杂度。
关于algorithm - 难以理解渐近符号,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52020941/
谁能证实这个算法的复杂度是 O(n^2)? a = 0 b = 0 c = n while (b <= c) { for (j = b; j<=c; j++) { a
问题(数据结构): 我们应该使用哪种表示来计算 O(|V|+|E|) 中图顶点的入度?这应该如何在 Khan 的算法中保持而不损害运行时间(渐近地)?证明您的主张。 我的尝试:我们应该使用矩阵表示来计
在某些情况下,对问题的蛮力方法具有复杂性,在性能方面不够好。 让我们举个例子西塔(n^2)。 使用递归方法可以将其改进为 Theta(nlogn)。 显然,渐近地人们会选择使用递归方法,因为对于越来越
我在 C++11 中使用 std::unordered_map。我在字符串键和复合数据类型之间做出决定(比如将两个 long 放在一个结构中以保存 UUID)。 当 hashmap 使用 std::s
它是 f(n)=theta(h(n)) 因为 theta 是可传递的。但是谁能解释为什么 h(n)=theta(f(n))。 最佳答案 通过定义扩展 Big-O 符号通常会使事情变得简单。 关于alg
我是一名优秀的程序员,十分优秀!