Algorithm Analysis and the Master Theorem
Design a Bad Sort Algorithm
- Goal: Design an inefficient sorting algorithm.
- Consideration: Time complexity.
The Master Theorem
Used to determine the time complexity of algorithms with specific recurrence relations.
General form:
where a > 0, b > 1, , , k > 0
Solutions:
- If \log_b a < c, then
- If , then
- If , then
Example:
- Given solution:
- Which can also be expressed as:
Applying the Master Theorem
- Objective: Use the master theorem to determine the time complexity of algorithms from recurrence relations.