Reducing traffic by reordering compatible filters

An archive preprocessing system uses a pipe-and-filter architecture. A batch contains 10,000 records, each initially 1,000 bytes wide. Three filters each run once:

  • Validation V retains exactly 80% of its incoming records and leaves their width unchanged.
  • Selection S retains exactly 25% of its incoming records and leaves their width unchanged.
  • Projection P retains every incoming record but reduces its width to 200 bytes by removing fields.

These retention fractions are guaranteed for this batch whether V or S runs first. Selection uses only fields retained by P and can run anywhere. Validation reads fields removed by P, so V must run before P. Apart from that restriction, the filters can be reordered without changing the final records.


The current pipeline connects a source to validation, projection, selection and an archive in that order.


Count bytes transmitted across all four channels: source to first filter, the two channels between filters, and last filter to archive. Every record crosses each applicable channel once; ignore headers, compression and retransmissions. Use 1 MB = 1,000,000 bytes.


Find the legal filter order that minimizes total traffic, the minimum traffic in MB to one decimal place, and the percentage reduction from the current V-P-S order to one decimal place. Enter the order using filter IDs separated by hyphens, such as V-P-S.

Your answers

Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors

More Architectural Patterns Questions: