我们什么时候应该使用soft-O、soft-Omega、soft-Theta

When should we use soft-O, soft-Omega, soft-Theta

我是算法领域的新手,多次遇到软符号。我不明白软符号的用法。根据维基百科,

'Essentially, it is big O notation, ignoring logarithmic factors because the growth-rate effects of some other super-logarithmic function indicate a growth-rate explosion for large-sized input parameters that is more important to predicting bad run-time performance than the finer-point effects contributed by the logarithmic-growth factor(s).' https://en.wikipedia.org/wiki/Big_O_notation#Extensions_to_the_Bachmann%E2%80%93Landau_notations

我不是很理解 soft-O 的定义。有人可以给我举个例子,说明我们必须使用 soft-O 而不是 big-O。非常感谢。

您使用不同的表示法来表示不同的精度级别。例如,您可以说

  • 合并排序最多使用 n ⌈lg n⌉ 比较

  • Mergesort 使用 O(n log n) 次比较

  • 归并排序使用 Õ(n) 次比较

第一个很挑剔但很精确。第三个是不精确的,但足以将其与插入排序进行比较(Õ(n) 与 Θ(n²))。

用 Õ 来抑制单个日志有点傻,但你也可以写成 log²n √(log log n) = Õ(1) 甚至将它扩展到 1/ε 近似方案的项,并且在复杂的算法中,跟踪这些因素真的很烦人。

尽管如此,您 永远不会使用软 O 表示法。您也不必使用大 O 表示法。您可以像 Knuth 一样引用 MMIX 处理器特定实现的指令数。就是方便。