Algorithm Complexity Analysis
Algorithm Complexity Analysis
Recursion
1. Fibonacci Sequence
2. Climbing Stairs
3. Reverse String
4. Happy Number
6. Strobogrammatic Number II
1. Quick Sort
2. Merge Sort
3. Majority Element
4. Calculate pow(x, n)
Binary Search
- Time Complexity: O(n * log h), where h is the maximum pile size
Greedy Method
- Kruskal's Algorithm:
- Time Complexity: O(E log E) + O(E * 4 * alpha), where 'E' times for sorting and union-find.
- Prim's Algorithm:
- Using adjacency list and Fibonacci heap: O(|E| + |V| log |V|)
- Time Complexity: