时间复杂度混淆的下限
lower bound of time complexity confusion
本文关键字:时间复杂度 更新时间:2023-10-16
这是否有可能证明存在任何基于比较的排序列表搜索算法的时间复杂度下限?换句话说,任何将排序列表和元素作为输入并输出列表中元素索引(如果出现)的算法是否必须采取一定数量的步骤?
执行您建议的特定算法的公认方法是二叉搜索 https://en.wikipedia.org/wiki/Binary_search_algorithm,其平均时间复杂度为 O(log N)。 如上面的评论所述,在完美的情况下,该算法和许多类似的算法可以在一个步骤中完成。
一般来说,证明算法是优化的是一个难题,它涉及对算法进行分类或诉诸琐碎。 您可以在此处找到更多信息:
https://cstheory.stackexchange.com/questions/1284/problems-that-can-be-used-to-show-polynomial-time-hardness-results
这里:
https://cstheory.stackexchange.com/questions/2038/what-techniques-are-used-for-proving-algorithms-optimal
在这里:
https://www.quora.com/Is-there-any-known-way-to-prove-that-an-algorithm-is-optimal
相关文章:
- 向量 <int> a {N, 0} 和 int arr a[N] = {0} 的时间复杂度有什么区别
- while循环中while循环的时间复杂度是多少
- 我可以创建一个包含两个变量的 for 循环,但时间复杂度仍然为 O(n) 吗?
- 函数的时间复杂度是多少?
- 如何检查两个 std::向量在小于 O(n) 的时间复杂度内是否相等
- 时间复杂度 当具有复合数据类型(如元组或对)时?
- 如何计算此排序函数的时间复杂度?
- 计算两个代码块的时间复杂度
- C++ 中具有 O(1) 搜索时间复杂度的数据结构
- 具有嵌套 if-else 的循环的时间复杂度
- 将树节点添加到向量向量中的 n 元树遍历的平均和最坏情况时间复杂度是多少?
- 如何计算函数的时间复杂度?
- 求解包含"variables"的 T(n) 时间复杂度
- 查找数字是否为 2 的幂的时间复杂度
- C++ - 最坏情况和平均情况插入时间复杂度在 std::unordered_map <int,int>?
- 为什么一种算法在相同的时间复杂度下比另一种算法更快?
- 关于记忆后这种递归关系的时间复杂度
- 2 个嵌套循环的时间复杂度
- 给定C++代码的时间复杂度是多少?
- 降低程序的时间复杂度