Python
Java
PHP
IOS
Android
Nodejs
JavaScript
Html5
Windows
Ubuntu
Linux
BFS和DFS的运行时间解释
为什么BFS和DFS的运行时间是O V E 特别是当有一个节点与从顶点可以到达的节点有有向边时 就像下面站点的这个例子 http www personal kent edu rmuhamma Algorithms MyAlgorithms
求解 a^3 + b^4 = c^3 + d^3 最佳运行时间
注意 这个问题不同于写出 a 3 b 3 c 3 d 3 的所有解 https stackoverflow com questions 14454133 write all solutions for a3 b3 c3 d3因为我需要帮助理
Algorithm
timecomplexity
complexitytheory
java中的排列迭代器
我想要一个类 它接受一个正整数并生成一个迭代器 让我迭代该正整数下的正数列表的所有可能的排列 例如 模拟器 p paermulator 3 p next gt 0 1 2 p next gt 0 2 1 p next gt 1 0 2 p
Java
timecomplexity
permutation
String.charAt(int i)在Java中是如何实现的?
如果我想使用检查字符串中的每个字符String charAt int i 是每次从头开始计数还是自动转换为数组并得到charAt直接索引 如果我创建一个 char 数组会更有效吗String toCharArray 然后按索引遍历数组 我可
Java
string
JavaDoc
timecomplexity
时间复杂度:删除双端队列的元素
删除一个元素的时间复杂度是多少collections deque E g deq collections deque 1 2 3 del deq 1 Summary 时间复杂度为 O n 其中 n 是到最近端点的距离 总尺寸为deque不要
python
Algorithm
datastructures
timecomplexity
deque
Ruby 中的哈希“has_key”复杂性
我有一个哈希vars a gt Name b gt Address c gt Phone 我想检查这条线的性能 vars has key b 是 O 1 还是 O 哈希大小 简单的基准 require benchmark iteration
rubyonrails
ruby
Algorithm
Hash
timecomplexity
使用递推方程的程序的时间复杂度
我想使用递归方程找出程序的时间复杂度 那是 int f int x if x lt 1 return 1 else return f x 1 g x int g int x if x lt 2 return 1 else return f
Algorithm
timecomplexity
recurrence
asymptoticcomplexity
为什么我们忽略大 O 表示法中的系数?
在寻找与 Big O 符号相关的答案时 我看到了很多SO答案 例如this https stackoverflow com questions 3255 big o how do you calculate approximate it t
Algorithm
bigo
timecomplexity
complexitytheory
确定两个未排序的数组是否相同?
给定两个unsorted arrays A and B具有不同的元素 确定是否A and B可以重新排列 使它们相同 我的策略如下 首先 使用确定性选择算法O N 是时候找到Max of A and Max of B 如果他们没有相同的Ma
Arrays
Algorithm
timecomplexity
Glibc 字符串操作函数的算法复杂度
我意识到 Glibc 源代码经过了极其优化 并且是手工编码的汇编 是否有任何文档分析了常用字符串操作函数的算法复杂性 Big O 例如strmcp strncmp etc 可能没有这方面的文档 因为它很简单 其复杂度为 O n strcmp
Algorithm
timecomplexity
关系的时间复杂度 T(n) = T(n-1) + T(n/2) + n
对于关系 T n T n 1 T n 2 n 我可以先解出项 T n 1 n 它给出 O n 2 然后解出项 T n 2 O n 2 吗 根据主定理 它也给出了 O n 2 或者它是错误的 不 你不能用主定理来解决它 你需要使用来解决它阿克
为什么数组插入的时间复杂度是 O(n) 而不是 O(n+1)? [复制]
这个问题在这里已经有答案了 我刚刚开始学习数据结构 在进行数组插入时 我想知道为什么数组插入的时间复杂度是 O n 而不是 O n 1 在最好的情况下 当插入在最后一个地方时 时间复杂度是O 1 我想我们正在考虑 1 插入元素 因为没有元素
Arrays
Algorithm
datastructures
timecomplexity
大 O 时间复杂度中的指数分母(分数指数)从何而来?
In algorithm descirptions I sometimes encounter time complexities that look like O n29 20 m7 3 I see where and numerator
Algorithm
bigo
timecomplexity
快速相似性检测
我有大量的对象 我需要找出它们之间的相似之处 确切地说 给定两个对象 我可以将它们的差异计算为数字 ametric http en wikipedia org wiki Metric 28mathematics 29 值越高意味着相似度越低
Algorithm
timecomplexity
similarity
Metric
这个带有嵌套循环的函数的复杂度是多少?
这段代码的复杂度是多少 public class test5 public static void main String args int n Integer parseInt args 0 for int i 1 i lt n i fo
timecomplexity
complexitytheory
为什么在 collections.deque 中间添加或删除比在那里查找慢?
This wiki python org https wiki python org moin TimeComplexity关于某些数据结构的算法复杂性的页面说以下内容collections deque object deque 双端队列
python
timecomplexity
deque
哈希表的查找时间总是 O(n) ?
我不明白如果存储桶的数量恒定 那么哈希表如何进行恒定时间查找 假设我们有 100 个桶和 1 000 000 个元素 这显然是 O n 查找 这就是理解非常大的 n 值时事物的行为方式的复杂性所在 因此 哈希表永远不是常量查找 它始终是 O
Algorithm
timecomplexity
HashTable
为什么我们不喜欢用 Big-O 表示法指定常数因子?
让我们考虑一下经典的大 O 表示法定义 证明链接 http www phil uu nl datastructuren 10 11 knuth big omicron pdf O f n 是存在正常数的所有函数的集合C and n0 wit
timecomplexity
bigo
constants
complexitytheory
python str.index 时间复杂度
为了找到字符串中子字符串的位置 需要一个简单的算法O n 2 时间 然而 使用一些有效的算法 例如KMP算法 https en wikipedia org wiki Knuth E2 80 93Morris E2 80 93Pratt al
python
Algorithm
timecomplexity
stringalgorithm
牛找到长栅栏间隙的算法
我正在看这个挑战 一头名叫萨姆的近视奶牛在目前的牧场上找不到足够的草 它记得牧场的围栏有一个缺口 不幸的是 栅栏很长 要绕一整圈 Sam 需要沿着栅栏走几步 山姆只能看到间隙就在它旁边 记住牛是近视的 在本题中 您将设计不同的算法 使 Sa
Algorithm
time
timecomplexity
«
1
2
3
4
5
6
7
8
...12
»