Expected Number of Loops When Each Server Forwards to a Random Peer
Last updated: November 29, 2026
Quick Overview
Ten servers are arranged by a random permutation so each forwards to exactly one server (possibly itself) and receives from exactly one. What is the expected number of forwarding loops, and the probability that all ten servers form one single loop?
Meta
November 29, 20260
0
0 solved
Ten servers are arranged by a random permutation so each forwards to exactly one server (possibly itself) and receives from exactly one. What is the expected number of forwarding loops, and the probability that all ten servers form one single loop?
Infrastructure interviews at Meta sometimes include probability about random structures like hash rings and forwarding tables. This question tests cycle structure of random permutations, linearity of expectation over a clever indicator, and verification by simulation.
What the Interviewer Expects
- Identifies loops as permutation cycles
- Derives E[cycles] = H_n using per-element or per-length indicators
- Computes H_10 of about 2.93
- Shows P(single cycle) = (n-1)!/n! = 1/n
- Checks with a simulation or small exact case
Key Topics to Cover
How to Approach This
- Define your hypotheses (H0 and H1) clearly before performing any test.
- Calculate required sample size BEFORE running an experiment, using power analysis.
- Remember the Central Limit Theorem: sample means become approximately normal with large n.
- Watch for Simpson's paradox. Always segment data by key dimensions.
- Distinguish between statistical significance and practical significance.
Possible Follow-up Questions
- What is the probability two specific servers are in the same loop?
- What is the expected length of the loop containing server 1?
- How does the expected number of self-loops compare?
- How would you generate a uniformly random single-cycle permutation?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Browse Statistics QuestionsSample Answer
Clarify
A uniformly random permutation of 10 servers; server forwards to . A loop is a cycle of , including fixed points (a server forwarding to itself)....
Approach
Expected cycles: each cycle can be credited as to each of its members, so where is the length of 's cycle. Known fact (and derivable by build...