Algorithms Analysis
Complexity of Search Algorithms
Linear Search ->
Binary Search ->
Data Strucutres
Stack: Push, Pop, Top ->
Queue: Insert, Remove ->
Set, Hashmap: Insert, Contains -> . Bad hashing functions could increase up to
Binary Search Trees: Insert, Delete, Search -> . In theory, it usually performs a bit worse than
Red Black Trees: Insert, Delete, Search , guarantee by the Red Black Property.
Sorting
Insertion Sort, Bubble Sort ->
Quick Sort -> but typically towards
Merge Sort ->
Theoretical Limit for Comparison Based Sorting is . More cool things about sorting at sorting
Graph Theory
Let V for Vertices, E for Edges.
DFS, BFS -> Full Search is
Djikstra -> Single Source SP is
Master Theorem
If a recurrence relation is defined as where
- asymptotically positive.
Then there are three cases:
- Case 1: for some , i.e. grows polynomially slower than . In this case, the work at leaves dominates: .
- Case 2: , i.e. and are asymptotically the same. In this case, the work is evenly distributed: .
- Case 3: for some , i.e. grows polynomially faster than . In this case, the work at root dominates: .