Mock 1

Part 1 (MC)

Q5: and not simply !
Q6: Gedächtnislosigkeit: not !
Q9: Karger is a MC algorithm always terminates but may return non-minimum cut.

Part 3 (Single Choice)

Q15: A server crashes on each day with . Let be the first day of the crash. Given that the server has survived 5 days, return
Answer: Memorylessness und nicht nur .

Q16: Randomised incremental algorithm for enclosing circle. What’s the expected number of times we have to recompute upon inserting a point?
Answer: we only have to recompute when is part of the 3 points that define a circle: .

Q17: Coupon collector for .
Answer: with so .
My mistake was not summing 1/p but p directly.

Part 4 (MC)

Q18: b) MC error reduction.
For a one sided error (i.e. it fails with p = ) over runs. So setting gives .
Then .
The bound is only needed for a one-sided error case with .

Q19: independent poisson variables sum together (ex: via convolution formula).

Q21: the colour coding algorithm from the lecture is Monte Carlo (result may still be wrong).

Part 5 (Proofs)

W1, probability We have coins and peaks (T, H, T) and they are not independent.
but we cannot use Chernoff to bound.
So instead, we ignore 2/3 of the coins and only care about blocks of 3 coins that are non-overlapping and thus independent. Let be the indicator of block being a peak.
Then and . As we can use Chernoff and get the result.

Technique: lower bound the sum of dependent and then apply Chernoff!

W2
a) Greedy path. As deg(v) >= d for all, there are always edges to a node not on the path left. We stop when and thus the path has edges.

Solution: Let be a longest path in . Every neighbour of must lie on otherwise you could extend contradicting maximality. Since has neighbours, all among , we get .

b) from a) we know there is a longest path of length . We choose a neighbour of (we know all of them are on the path from a.) with maximal.
We get . Since the closed walk has vertices and since they are pairwise distinct (they lay on a path), is a cycle with .

c) Greedy grow a path, keeping list of “visited”. When no more neighbour exists, the current path is non-extendable. By a) and b) the furthest neighbour of along the path yields a cycle of length .
Correctness: follows from a) and b) applied to our path.
Runtime: every vertex enters at most once, every adjacency list only scanned constant amount of time. .

Part 6 (CE)

2 Probability of success , with optimal “playing/choices”. So we go backwards.

  • Backward DP when optimal choice, it depends on all future possible states.
  • dp[i][j] = Math.max(dp[i+1][j+1], dp[i+1][j+2]*p[i] + dp[i+1][j]*(1 - p[i])).

Mock 2

Part 1 (MC)

Q3 The complete Graph for contains exactly distinct Hamiltonian cycles.
False! it’s cycles counted twice, once for each direction!

Q6 If independent, then also independent. True
Proof is easy:

  • ()
  • (by indep.)
  • .

Part 2 Algos

Give a minimum cut and prove that your flow is indeed maximal:
Solution:

  • Give , and count the capacity of the edges crossing that cut (only in forward direction)
  • Then say: by MaxFlow MinCut theorem, and as my flow and cut are equal, is maximal and is a minimal cut!

Include Proof

Make sure to state the proof here!

Part 3 (Numeric)

Q1 3 cards from 52 card deck, prob = all heart
. Calculate cleanly!

Q2 . Compute !
Two ways:

  • (i.e. probability we rolls above at least twice)

Geometric probs

for a geometric distribution!!!!

Don’t be an idiot.

Q16: Jarvis Hull runtime . FindNext takes scan all points to find the “right most”. Then repeat times, once for each corner.

Q17: of two dice roll.
I am an idiot and forgot the squaring I think.
Right way to do it is . with .

Part 4 (MC)

Q1:

  1. Every tree contains at most one perfect matching
    1. true proven by induction
    2. the leaves force it
  2. Every 3-regular graph contains a perfect matching.
    1. false, counterex is literally in the notes
    2. Frobenius theorem requires bipartiteness

Q2:

  1. Expected number of comparisons of randomised Quicksort is .
    1. For each pair of numbers, we count comparisons
    2. probability of comparison falls of harmonically for further apart.
    3. This gives prob =
    4. Repeat times.

Q3:

  1. for every . True.
    1. then always gives a positive internal value
    2. can have some cancelling each other out internally

Q4:

  1. Distinct number of cuts in a Network is exactly . true
    1. and fixed.
    2. For the rest, we can either put them in or (binary choice)
    3. vertices free to choose!

Part 5 Proofs

W1: c) Hashing collisions for keys into buckets. Prove that .

  • There are distinct pairs of keys.
  • Split into two cases: share zero/one keys
    • if zero: independent case and thus covariance vanishes
    • if one: the probability that all three hash into the same bucket. But then covariance also vanishes.
  • .
  • We upper bound as .
    • Then in which we can sub in .
    • .
    • Then Chebychev, upper bounding again.

W2:

  1. Prove that a -regular bipartite graph has a perfect matching
    1. we prove by using that each edge counts one for both sides
      1. as .
    2. For Hall, choose .
      1. as the subset of incident edges incident edges.
      2. .

Mock 5

Part 1 (MC)

Mini-Proof for and then as well.
Proof: We know that for a geometrically distributed ZV as we need k non-successes.

  • Thus
  • .

If exists (is finite), then is also finite. False!
Proof For a symmetric distribution with infinite tails we never reach zero, as , but as it’s symmetric .
But is infinite, as there’s p-mass at infinite distance.

Worst Case runtime of Quickselect is . True
only the expected runtime is ! For worst case pivot choices we can still get

Worst case vs. Expected

Always make sure to check whether it’s expected runtime or worst-case runtime.

Part 2 (Algos from Lectures)

Review Quickselect Exp. Runtime proof.
The gist:
“For each call of QuickSelect, the pivot has a 1/2 chance of reducing the number of elements to . Thus .”

Part 3 (Numeric)

Walds Identity: For and independent ZV with then .

Wie viele runs von Karger für minCut prob >= 1 - 1/e?
Wir wissen, dass . Nach runs gilt:

    • also gilt auch .

Part 4 (MC)

Every -vertex connected graph with at least vertices is also -edge connected. True!
Intuitively: removing a vertex removing at least edge (as it’s -vertex connected it can’t be disjoint).
Thus if we have to remove at least 2 vertices to make the graph disjoint, we also have to remove edges.

  • This is “vertex-conn(G) edge-conn(G) min-deg(G)”
    That would already suffice, but here is a proof without it:
    Proof: For contradiction assume such a graph exists. Let with be the edge for which is disjoint.
  • if both and have degree , is -vertex-connected as and removing isolates .
  • Assume WLOG . Then in , , also removes the edge from the graph.
  • Thus is disjoint as there is no path from to any of ‘s neighbours anymore (otherwise is not a bridge)

can only hold if and are independent. False.
For uniform and we have dependence:

  • but .
    But and and .
    Thus .

has at most distinct minimum cuts. True.
(Proven in Theory-Sheet 7 ex 1.b.)
Karger finds a specific min-cut , set of all min-cuts with probability . Thus . This implies that as the sum of probabilities must .

Karger finds all of them in expectation in . This holds because we have a coupon collector over the cuts, which adds a factor to the to find a single one.

Part 5 (Proofs)

W1 c) Compute exactly, deduce and use Chebychev to show…
To compute notice that

    • we know so
  • For which is only for thus .
  • Therefore .
    Chebychev gives us .

W2 b) Let be a graph with exactly two vertices of odd-degree. Show that contains a --path.
Proof: Assume for contradiction that does not.

  • then and lie in different connected components.
  • The connected component with is itself a graph and the handshake lemma holds sum of degrees is even.
  • But it contains exactly one odd-degree vertex, while the handshake tells us that the sum must be even contradiction.
  • Thus and in the same component u-v-path.