Sequential Search — Complexity
Sequential Search (Linear Search) is a method that checks each element one by one until the target is found or the list ends.
Time Complexity:
- Best Case: O(1) — element found at the first position
- Worst Case: O(n) — element found at the last position or not present
- Average Case: O(n)
Space Complexity: O(1) — no extra space is used (in-place search)
Master Theorem — Rules for Finding Asymptotic Bounds
The Master Theorem provides a direct solution for recurrences of the form:
T(n)=aT(bn)+f(n)
where a≥1, b>1, and f(n) is an asymptotically positive function.
Let ccrit=logba, then the three cases are:
Case I: If f(n)=O(nc) where c<logba, then:
T(n)=Θ(nlogba)
Case II: If f(n)=Θ(nc) where c=logba, then:
T(n)=Θ(nlogba⋅logn)
Case III: If f(n)=Ω(nc) where c>logba, and if a⋅f(bn)≤k⋅f(n) for some k<1 (regularity condition), then:
T(n)=Θ(f(n))
Conclusion: Sequential search has linear time complexity, while the Master Theorem efficiently determines the asymptotic bound of divide-and-conquer recurrences by comparing f(n) with nlogba.