编程语言/时间复杂度:修订间差异
来自康健生活
< 编程语言
| 第1行: | 第1行: | ||
== 引言 == | == 引言 == | ||
渐进时间复杂度(asymptotic time complexity),表示代码执行时间随着数据增长的变化趋势。记为 < | 渐进时间复杂度(asymptotic time complexity),表示代码执行时间随着数据增长的变化趋势。记为 <math>O(n)</math>。n 代表输入数据的量。 | ||
== 常规复杂度 == | == 常规复杂度 == | ||
常规复杂度一般有四种:<math>O(1)</math>、<math>O(n)</math>、<math>O(\log_{2} n)</math>、<math>O(n\log_{2} n)</math>、<math>O(n^2)</math> | 常规复杂度一般有四种:<math>O(1)</math>、<math>O(n)</math>、<math>O(\log_{2} n)</math>、<math>O(n\log_{2} n)</math>、<math>O(n^2)</math> | ||
2020年7月7日 (二) 13:37的版本
引言
渐进时间复杂度(asymptotic time complexity),表示代码执行时间随着数据增长的变化趋势。记为 。n 代表输入数据的量。
常规复杂度
常规复杂度一般有四种:、、、、
- :数据量与耗时同步增大,eq:遍历
- :eq:冒泡排序。
- :eq:二分查找。
- :eq:归并排序。
- :eq: 哈希算法。
标题文字
顺序存储
时间复杂度是O(n)
链式存储
时间复杂度是O(n^2)
No categories