如何衡量算法?
作者:
GeekAmI | 来源:发表于
2024-02-02 18:01 被阅读0次
一、复杂度符号(Big O notation)
- O(1): Constant Complexity 常数复杂度
- O(log n): Logarithmic Complexity 对数复杂度 O(n): Linear Complexity 线性时间复杂度
- O(n^2): N square Complexity 平⽅
- O(n^3): N cube Complexity 立⽅
- O(2^n): Exponential Growth 指数
- O(n!): Factorial 阶乘

https://javachallengers.com/big-o-notation-explanation/
二、主定理(Master Theorem)

image.png
三、复杂度优化示例
斐波那契数:https://leetcode.cn/problems/fei-bo-na-qi-shu-lie-lcof/solutions/976990/tong-ge-lai-shua-ti-la-yi-ti-si-jie-zhan-fjir/
本文标题:如何衡量算法?
本文链接:https://www.haomeiwen.com/subject/ppctadtx.html
网友评论