Midterm Methods Flashcards

(19 cards)

1
Q

Propose-and-Reject Algorithm (Gale-Shapley)

A
  1. Each unmatched job proposes to its highest-ranked remaining candidate
  2. Each candidate tentatively accepts their best offer and rejects others
  3. Rejected jobs mark candidates as unavailable and try next preference
  4. Repeat until all jobs are matched
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Finding an Eulerian Tour

A
  1. Start at any vertex
  2. Follow unused edges, deleting them as you go
  3. If stuck at a vertex with no unused edges, place the path there
  4. Start a new path from a vertex with unused edges that’s already in the tour
  5. Merge the new path with the existing tour
  6. Repeat until all edges are used
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Fast Modular Exponentiation

A
  1. Convert exponent to binary
  2. Start with result = 1
  3. For each bit from left to right:
    a. If current bit is 0result^2 (mod m)
    b. If current bit is 1result^2 * base (mod m)
  4. Return final result
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Euclid’s Algorithm for GCD

A
  1. If y = 0, return x
  2. Otherwise, return gcd(y, x mod y)
  3. Repeat until remainder is 0
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Extended Euclid’s Algorithm

A
  1. If y = 0, return (1, 0, x) representing 1·x + 0·y = x
  2. Otherwise, recursively find (a', b', d) = extended_gcd(y, x mod y)
  3. Return (b', a' - b'·⌊x/y⌋, d) representing a·x + b·y = d
  4. Base values are returned up the recursion to find coefficients
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

RSA Setup Procedure

A
  1. Choose two distinct large prime numbers p and q
  2. Compute N = p × q
  3. Calculate φ(N) = (p-1)(q-1)
  4. Choose public exponent e where 1 < e < φ(N) and gcd(e, φ(N)) = 1
  5. Determine private key d where d·e ≡ 1 (mod φ(N))
  6. Public key is (N, e), private key is d
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Lagrange Interpolation

A
  1. For each point (xᵢ, yᵢ), create basis polynomial Lᵢ(x)
  2. For each Lᵢ(x), compute Lᵢ(x) = ∏(j≠i) (x-xⱼ) / (xᵢ-xⱼ)
  3. Combine as P(x) = ∑yᵢ·Lᵢ(x)
  4. Simplify the resulting polynomial
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Shamir’s Secret Sharing

A
  1. Choose secret S and threshold k
  2. Create random polynomial P of degree k-1 with P(0) = S
  3. Compute n distinct points (i, P(i)) for participants
  4. Distribute points to n participants
  5. Any k participants can reconstruct using Lagrange interpolation
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Error Correction for Erasures

A
  1. Represent message as values of a polynomial P(x)
  2. Transmit values at points x₁,...,xₙ₊ₖ
  3. If k erasures occur, use remaining n points
  4. Apply Lagrange interpolation to recover original polynomial
  5. Extract message from P(x)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Berlekamp-Welch Algorithm for Error Correction

A
  1. Assume received values rᵢ at positions xᵢ
  2. Create error locator polynomial E(x) of degree k
  3. Create Q(x) = P(x)·E(x) of degree n-1+k \ n4. Set up system of n equations: Q(xᵢ) = rᵢ·E(xᵢ)
  4. Solve for coefficients of Q and E
  5. Compute P(x) = Q(x) / E(x)
  6. Extract original message from P(x)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Cantor’s Diagonalization Proof

A
  1. Assume set S is countable
  2. List elements of S as s₁, s₂, s₃, …
  3. Construct element t that differs from sₙ in nth position
  4. Show t must be different from every element in the list
  5. Conclude t ∈ S but t is not in the enumeration
  6. This contradiction proves S is uncountable
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Constructing a Bijection between N and Z

A
  1. Define f: N → Z as follows:
  2. f(0) = 0
  3. For positive n, if n is odd: f(n) = (n+1)/2
  4. For positive n, if n is even: f(n) = -n/2
  5. This maps {0,1,2,3,4,5,…} to {0,1,-1,2,-2,3,…}
  6. Verify f is both injective and surjective
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Proving Set Equality

A
  1. Prove A ⊆ B: Show that if x ∈ A, then x ∈ B
  2. Prove B ⊆ A: Show that if x ∈ B, then x ∈ A
  3. Conclude A = B
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Constructing Truth Tables

A
  1. Identify all atomic propositions
  2. Create columns for each proposition and operator
  3. List all possible combinations of truth values
  4. Fill in truth values working from innermost to outermost operators
  5. Read final column for the truth value of the entire statement
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Method for Strong Induction Proof

A
  1. Establish base case(s): Prove P(0), P(1), etc. as needed
  2. State induction hypothesis: Assume P(0), P(1), …, P(k) all true
  3. Prove inductive step: Show P(k+1) follows from the hypothesis
  4. Conclude P(n) holds for all required n
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Finding Minimum Spanning Tree (Kruskal’s Algorithm)

A
  1. Sort all edges by weight (ascending)
  2. Start with empty graph T
  3. For each edge in sorted order:
    a. If adding the edge creates a cycle, skip it
    b. Otherwise, add the edge to T
  4. Continue until T has n-1 edges (where n is number of vertices)
17
Q

Solving Linear Congruence ax ≡ b (mod m)

A
  1. Find gcd(a, m)
  2. If b is not divisible by gcd(a, m), no solution exists
  3. Otherwise, divide all terms by gcd(a, m) to get a’x ≡ b’ (mod m’)
  4. Find a⁻¹ (mod m’) using Extended Euclidean Algorithm
  5. Compute x ≡ a⁻¹·b’ (mod m’)
  6. Generate all solutions: x₀, x₀ + m’, x₀ + 2m’, …, x₀ + (gcd(a,m)-1)m’
18
Q

Chinese Remainder Theorem Implementation

A
  1. Given system x ≡ aᵢ (mod nᵢ) where all nᵢ are pairwise coprime
  2. Compute N = n₁·n₂·…·nₖ
  3. For each i, compute Nᵢ = N/nᵢ
  4. For each i, find Mᵢ where Mᵢ·Nᵢ ≡ 1 (mod nᵢ) using Extended Euclidean Algorithm
  5. Compute x ≡ ∑(aᵢ·Nᵢ·Mᵢ) (mod N)
19
Q

Applying Principle of Inclusion-Exclusion

A
  1. To find |A₁ ∪ A₂ ∪ … ∪ Aₙ|:
  2. Start with sum of individual set sizes: ∑|Aᵢ|
  3. Subtract all pairwise intersections: -∑|Aᵢ ∩ Aⱼ|
  4. Add back triple intersections: +∑|Aᵢ ∩ Aⱼ ∩ Aₖ|
  5. Continue alternating signs for larger intersections\n6. Final term is (-1)ⁿ⁺¹|A₁ ∩ A₂ ∩ … ∩ Aₙ|