娱乐:如何证明 n = O(1)
Mar 21, 2011在 MIT Introduction to Algorithms Lec 2 看到:
To prove n = O(1) by induction:
Base case:
1 = O(1)
Induction step:
If n-1 = O(1),
then n = (n-1) + 1 = O(1) + O(1) = O(1)
这样一来所有算法都是constant time了 ;)
至于上面的证明错在哪里,请移步原视频22min.