Expected Wait for a Bus That Runs Late Half the Time

Quick Overview

This question evaluates a candidate's understanding of probabilistic modeling and expectation calculations for stochastic arrival processes, touching on renewal-theory concepts and length-biased sampling phenomena relevant to timing and queuing problems.

Expected Wait for a Bus That Runs Late Half the Time

Company: Optiver

Role: Data Scientist

Category: Machine Learning

Difficulty: medium

Interview Round: Technical Screen

Buses on a certain route are scheduled to arrive at your stop every $x$ minutes. Independently for each bus, the bus arrives exactly on schedule with probability $1/2$, and exactly $x/2$ minutes late with probability $1/2$ (a bus is never early). You walk up to the stop at a uniformly random moment, independent of the schedule and of the delays, and you board the first bus that arrives after you get there. What is your expected waiting time, expressed in terms of $x$? ```hint Model one schedule slot Place your arrival uniformly inside the interval between two consecutive *scheduled* times. Whether the bus scheduled at the start of that slot is still ahead of you depends on its delay — a late bus scheduled *before* you arrived may still be the one you catch. Condition on the delays of the two surrounding buses. ``` ```hint A renewal shortcut The delays never reorder buses (a delay of $x/2$ is smaller than the $x$ headway), so the timeline is a stationary sequence of gaps $G$ between consecutive bus arrivals. A uniformly random arriver is more likely to land in a long gap, so the expected wait is $\frac{E[G^2]}{2\,E[G]}$, not $E[G]/2$. Work out the distribution of the gap $G$ first. ``` ### Constraints & Assumptions - The scheduled headway is exactly $x$ minutes, and the schedule extends indefinitely (analyze the steady state, ignoring boundary effects). - Each bus is late by exactly $x/2$ minutes with probability $1/2$ and on time otherwise; delays are independent across buses; buses are never early. - Because the maximum delay $x/2$ is smaller than the headway $x$, buses never overtake one another. - Your arrival time is uniform over a long horizon and independent of all delays; the waiting time ends when the next bus arrives at the stop. ### Clarifying Questions to Ask - Is the delay exactly $x/2$ minutes, or up to $x/2$ (e.g., uniformly distributed)? - Are the delays of different buses independent of each other? - Can a bus ever be early, and can buses overtake each other? - Do I board the first bus that physically arrives, regardless of which scheduled run it corresponds to? - Should I treat my arrival as uniformly random in steady state, with no boundary effects at the start of service? ### What a Strong Answer Covers ```premium-lock What a Strong Answer Covers ``` ### Follow-up Questions - Recompute the expected wait if each bus's delay is instead uniform on $[0, x/2]$. - Generalize: if a bus is late by $d$ minutes with probability $p$ (and on time otherwise, with $d < x$), what is the expected wait as a function of $x$, $p$, and $d$? - What does your gap-based formula say about why irregular headways always increase a random rider's expected wait, even when the mean headway stays the same? - How would the answer change qualitatively if buses instead arrived as a Poisson process with mean headway $x$?

Quick Answer: This question evaluates a candidate's understanding of probabilistic modeling and expectation calculations for stochastic arrival processes, touching on renewal-theory concepts and length-biased sampling phenomena relevant to timing and queuing problems.

|Home/Machine Learning/Optiver
Optiver logo
Optiver
Mar 21, 2025, 12:00 AM
mediumData ScientistTechnical ScreenMachine Learning
2
0

Buses on a certain route are scheduled to arrive at your stop every xx minutes. Independently for each bus, the bus arrives exactly on schedule with probability 1/21/2, and exactly x/2x/2 minutes late with probability 1/21/2 (a bus is never early). You walk up to the stop at a uniformly random moment, independent of the schedule and of the delays, and you board the first bus that arrives after you get there.

What is your expected waiting time, expressed in terms of xx?

Constraints & Assumptions

  • The scheduled headway is exactly xx minutes, and the schedule extends indefinitely (analyze the steady state, ignoring boundary effects).
  • Each bus is late by exactly x/2x/2 minutes with probability 1/21/2 and on time otherwise; delays are independent across buses; buses are never early.
  • Because the maximum delay x/2x/2 is smaller than the headway xx , buses never overtake one another.
  • Your arrival time is uniform over a long horizon and independent of all delays; the waiting time ends when the next bus arrives at the stop.

Clarifying Questions to Ask Guidance

  • Is the delay exactly x/2x/2 minutes, or up to x/2x/2 (e.g., uniformly distributed)?
  • Are the delays of different buses independent of each other?
  • Can a bus ever be early, and can buses overtake each other?
  • Do I board the first bus that physically arrives, regardless of which scheduled run it corresponds to?
  • Should I treat my arrival as uniformly random in steady state, with no boundary effects at the start of service?

What a Strong Answer Covers Premium

Follow-up Questions Guidance

  • Recompute the expected wait if each bus's delay is instead uniform on [0,x/2][0, x/2] .
  • Generalize: if a bus is late by dd minutes with probability pp (and on time otherwise, with d<xd < x ), what is the expected wait as a function of xx , pp , and dd ?
  • What does your gap-based formula say about why irregular headways always increase a random rider's expected wait, even when the mean headway stays the same?
  • How would the answer change qualitatively if buses instead arrived as a Poisson process with mean headway xx ?
Loading comments...