Skip to content

Commit d61d4da

Browse files
committed
debug code | apply right formating
1 parent 87b9f9c commit d61d4da

28 files changed

+1878
-2231
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
id: binary-search-dsa
3+
title: Binary Search
4+
sidebar_label: Binary Search
5+
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."
6+
tags: [dsa, algorithms, binary search]
7+
---

docs/dsa/binary_search/binary_search.md

Lines changed: 0 additions & 133 deletions
This file was deleted.

docs/dsa/master-theorem.md

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -17,21 +17,21 @@ tags:
1717

1818
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:
1919

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+
$$
2323

2424
where:
2525

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$.
3535

3636
The Master Theorem provides a way to determine the time complexity of the algorithm based on the values of `a`, `b`, and `f(n)`.
3737

@@ -47,9 +47,9 @@ The Master Theorem has three cases based on the comparison of `f(n)` with `n^log
4747

4848
Let's consider the recurrence relation for the Merge Sort algorithm:
4949

50-
```plaintext title="Merge Sort Recurrence Relation"
51-
T(n) = 2T(n/2) + Θ(n)
52-
```
50+
$
51+
\boldsymbol{{T(n)} = aT \frac{n}{b} + f(n)}
52+
$
5353

5454
Here:
5555

@@ -177,7 +177,10 @@ Master Theorem is a powerful tool to analyze the time complexity of divide and c
177177

178178
```jsx live
179179
function MasterTheoremExample() {
180-
const a = 2, b = 2, f = 2, n = 4;
180+
const a = 2,
181+
b = 2,
182+
f = 2,
183+
n = 4;
181184
182185
function MasterTheorem(a, b, f, n) {
183186
if (a < 1 || b < 1) {
@@ -203,4 +206,4 @@ function MasterTheoremExample() {
203206
</div>
204207
);
205208
}
206-
```
209+
```
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"label": "GFG Problems",
3+
"position": 3,
4+
"link": {
5+
"type": "generated-index",
6+
"description": "You will learn about the GFG Problems of Data Structures and Algorithms."
7+
}
8+
}

0 commit comments

Comments
 (0)