You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
description: "In this blog post, we'll dive into the binary search algorithm, a fundamental technique in computer science for efficiently finding an element in a sorted array."
Copy file name to clipboardExpand all lines: docs/dsa/master-theorem.md
+20-17Lines changed: 20 additions & 17 deletions
Original file line number
Diff line number
Diff line change
@@ -17,21 +17,21 @@ tags:
17
17
18
18
Master Theorem is a popular technique to solve recurrence relations of divide and conquer algorithms. It provides a way to determine the time complexity of recursive algorithms. The theorem is used to solve recurrences of the form:
19
19
20
-
```plaintext title="Recurrence Relation"
21
-
T(n) = aT(n/b) + f(n)
22
-
```
20
+
$$
21
+
\boldsymbol{{T(n)} = aT \frac{n}{b} + f(n)}
22
+
$$
23
23
24
24
where:
25
25
26
-
-`T(n)` is the time complexity of the algorithm.
27
-
-`a` is the number of subproblems in the recursion.
28
-
-`n/b` is the size of each subproblem.
29
-
-`f(n)` is the time complexity of the work done outside the recursive calls.
30
-
-`n` is the size of the input.
31
-
-`a >= 1` and `b > 1` are constants.
32
-
-`f(n)` is a function that is asymptotically positive.
33
-
-`T(n)` is defined on non-negative integers.
34
-
- The recurrence relation is defined for `n >= n0` for some constant `n0`.
26
+
-$T(n)$ is the time complexity of the algorithm.
27
+
-$a$ is the number of subproblems in the recursion.
28
+
-$\frac{n}{b}$ is the size of each subproblem.
29
+
-$f(n)$ is the time complexity of the work done outside the recursive calls.
30
+
-$n$ is the size of the input.
31
+
-$a \geq 1$ and $b > 1$ are constants.
32
+
-$f(n)$ is a function that is asymptotically positive.
33
+
-$T(n)$ is defined on non-negative integers.
34
+
- The recurrence relation is defined for $n \geq n_0$ for some constant $n_0$.
35
35
36
36
The Master Theorem provides a way to determine the time complexity of the algorithm based on the values of `a`, `b`, and `f(n)`.
37
37
@@ -47,9 +47,9 @@ The Master Theorem has three cases based on the comparison of `f(n)` with `n^log
47
47
48
48
Let's consider the recurrence relation for the Merge Sort algorithm:
0 commit comments