Preparing your design workspace

Loading the problem and your latest saved attempt…

Design a Communication-Efficient Distributed Median Aggregation

Compute an exact median across ten partitioned workers while balancing transmitted bytes against coordinated rounds.

Problem statement

For this exercise, assume one immutable batch of 1,000 signed 64-bit integer values is split into disjoint partitions across exactly 10 workers. A coordinator must return the exact median: the arithmetic mean of the 500th and 501st values in sorted order, represented without rounding.

Minimize bytes sent between workers and the coordinator, and report protocol round trips as a separate cost. All ten partitions must contribute to an exact result; an incomplete run returns a retryable failure. Design the job contract, distributed selection protocol, state ownership, and communication trade-offs.

What to build

  1. Start a median-computation run against one immutable manifest containing exactly ten disjoint worker partitions.
  2. Return the exact two central order statistics and their unrounded arithmetic mean, including correct duplicate handling.
  3. Expose pending, succeeded, and retryable-failure outcomes without publishing a result from incomplete partition evidence.
  4. Report total worker/coordinator payload bytes and the number of coordinated protocol rounds used by the run.

At scale

  • Each run contains exactly 1,000 signed 64-bit integers split across 10 disjoint worker partitions.
  • Each worker can sort or index its own partition in memory, but the coordinator should avoid collecting all raw values unless that trade-off is justified.
  • The primary optimization is payload bytes; round trips and end-to-end completion time are separately observable costs.
  • Every exact rank decision must include all 10 partitions, and missing or mismatched contributions produce a retryable failure.