Course: Advanced Data Structures and Algorithms
-
Goal: Find
$x, y$ such that$ax + ny = GCD(a, n)$ . -
Iterative Derivation [00:18:10]:
- Each remainder
$R_i$ is a linear combination:$R_i = x_i a + y_i n$ . - Using
$R_i = R_{i-2} - q_i R_{i-1}$ (where$q_i = \lfloor R_{i-2} / R_{i-1} \rfloor$ ):$x_i = x_{i-2} - q_i x_{i-1}$ $y_i = y_{i-2} - q_i y_{i-1}$
- Each remainder
-
Initialization:
- (
$R_0=a, x_0=1, y_0=0$ ) - (
$R_1=n, x_1=0, y_1=1$ )
- (
-
Result: When
$R_i = 0$ ,$R_{i-1}$ is the GCD, and$x_{i-1}, y_{i-1}$ are the Bezout coefficients.
-
Definition:
$a^{-1} \pmod n$ is the value$x$ such that$ax \equiv 1 \pmod n$ . -
Existence:
$a^{-1} \pmod n$ exists if and only if$GCD(a, n) = 1$ . -
Calculation: Run EEA on (
$a, n$ ). If$d=1$ , then$x \pmod n$ is the inverse. - Applications [01:00:00]: Used in encryption/decryption (e.g., RSA), digital signatures, and blinding techniques.
-
Z*n: The set of integers
${1, 2, ..., n-1}$ that are relatively prime to$n$ .
- History [01:21:40]: von Neumann (1945) introduced Merge Sort to demonstrate the superiority of the Stored Program Concept on his EDVAC-style machines over traditional mechanical punch-card sorters.
-
Algorithm (Divide and Conquer):
-
Divide: Split array into two halves at
$q = \lfloor n/2 \rfloor$ . -
Conquer: Recursively
MergeSortboth halves. -
Combine:
Mergethe two sorted halves in$O(n)$ time.
-
Divide: Split array into two halves at
- Merge Logic [01:46:27]: Compare the heads of two sorted lists. Pull the minimum and advance that list's pointer. If one list exhausts, copy the remainder of the other.
-
Recurrence Relation:
$$T(n) = T(\lfloor n/2 \rfloor) + T(\lceil n/2 \rceil) + (n-1)$$ -
Solving for
$n = 2^k$ :- Dividing by
$2^k$ :$S_k = S_{k-1} + 1$ (approx). -
$S_k = k$ . -
$T(2^k) = 2^k \cdot k = n \log n$ .
- Dividing by
-
Smoothness Assumption [02:21:22]: We assume
$T(n)$ grows predictably between powers of 2, thus$T(n) \in \Theta(n \log n)$ for all$n$ .
- Textbooks:
- CLRS (Cormen): Recommended for rigorous math and RSA details.
- Jeff Erickson: Highly recommended for clear pseudo-code and intuitive logic.
- Warning on Attendance [02:38:09]: The instructor expresses deep concern over falling attendance (~35 students present). He warns that these concepts are difficult to learn through self-study and that missing classes could lead to disqualification from the final exam.
Key Terms Corrected:
- bis out identity -> Bezout's Identity
- u plates algorithm -> Euclidean Algorithm
- Horacea -> RSA
- Revist Shamir Adelman -> Rivest, Shamir, and Adleman
- Lomato partition -> Lomuto Partition
- heave sort -> Heap Sort