Tying rope ends in a bag
Asked at Jane Street, Optiver, Citadel
A bag contains 100 ropes, so there are 200 loose ends sticking out. Repeatedly, you reach in and pick two loose ends uniformly at random and tie them together. You keep doing this until no loose ends remain (100 ties total). Each tie may join two different ropes into a longer strand, or join the two ends of the same strand into a closed loop.
What is the expected number of loops formed?
Show a hint
Use linearity of expectation. At each tie, what is the probability you close a loop, given how many ends remain?