Asymptotic Analysis
Merge Sort
- Divide & Conquer
- 意義
N/2,要除幾次才會得到1
Insertion Sort/Selection Sort/Bubble Sort
- Time complexity:
- Worst Case Analysis
- easy to find, more general.
- Constant factors depends on architectures, compilers, programming implementations or even compiler optimizations. No need to precise the constants.
- We identify Fast Algorithms as “worst-case running time grows slowly with input size”.
- Suppress for two:
- constant factors, too system-dependent.
- lower order terms, irrelevant for large inputs.
- Suppress for two:
- Linear Time is some of the cases the best scenario.
- Big-Oh (, Upper Bound)
- If there exist constants , , such that , for all
- Big Omega (, Lower Bound)
- Big Theta (, sandwitch)
- Little-Oh notation:
- Strictly, no equal
- , For all , there exists some , such that for all .