常用算法复杂度
算法分析 主定律: Master Theorem
常用算法的时间复杂度
Algorithm | Recurrence relationship | Run time |
Binary Search | T(n) = T(n/2) + O(1) | O(logn) |
Binary Tree traversal | T(n) = 2T(n/2) + O(1) | O(n) |
Optimal sorted matrix search | T(n) = 2T(n/2) + O(logn) | O(n) |
Merge sort | T(n) = 2T(n/2) + O(n) | O(nlogn) |