cs-138 — The Downtime Ledger
| Field | Value |
|---|---|
| id | cs-138 |
| difficulty | Foundational |
| topics | reliability, aggregation, data |
| lecture | lecture-14 |
| estimated time | 5-minute attempt + 10-minute discussion |
| prerequisites | lecture-09 (aggregation), lecture-13 (dictionaries and sets) |
| objective | turn a raw incident log into per-system reliability answers with an explicit double-count decision |
| solution | held by the instructor; discussed after the attempt |
Problem
The IT helpdesk logged last week's outages, one line per incident:
sys start end cause
W1 Mon 09:10 Mon 09:40 network
W1 Mon 09:30 Mon 10:00 network
W2 Mon 09:20 Mon 09:50 power
DB Tue 14:00 Tue 14:25 software
W1 Wed 08:00 Wed 08:30 power
W2 Wed 08:10 Wed 08:40 power
DB Thu 16:45 Thu 17:15 software
W2 Fri 10:00 Fri 10:20 network
Two facts about the log: overlapping incidents on the same system can happen (the Monday W1 pair), and the helpdesk logs the reported cause.
Your deliverables:
- Total downtime per system — stating explicitly whether overlapping incidents are counted twice or merged, and why your choice fits the question "how reliable was each system?".
- Cause counts, as a small table (system × cause).
- Which system you would flag for investigation, justified by your table — one sentence.
- One question you would ask the helpdesk about how they log before trusting this table further.
If the problem is ambiguous anywhere, state the assumption you are making and carry on — a stated assumption is part of a good answer.
Examples
- Input: the eight-row incident log
- Output: per-system minutes (W1 90 raw vs 80 merged, W2 80, DB
- — cause table — one flagged system — one logging question
Solve for the worked instance first. Then ask what would change if one number, name, or condition were replaced by something stranger.
What to notice
- Aggregation is a decision before it is arithmetic: the merge-or-double-count choice changes W1's answer by 30 minutes, so it must be stated, not implied.
- The aggregation choice can change the ranking: raw sums put W1 worst (90 min), but merging its Monday overlap leaves W1 and W2 tied at 80 — say which number you are reporting and why.
- The same cause on different systems is a pattern worth surfacing, which the raw log hides.
Discussion starter
After the solution is revealed, the class spends five minutes on this prompt: "Management asks for 'uptime' as a percentage. What extra number do you need beyond this log, and what denominator trap must you avoid?"
Constraints and assumptions
- Difficulty: Foundational (structured aggregation with a judgement call).
- Topics: reliability, aggregation, data.
- All times fall within one service week; no incident crosses midnight.
- Classroom-scale inputs unless the problem says otherwise.
- Time-box: about five minutes for a first attempt; partial answers with clear reasoning are worth more than silent struggling.
- Optional stretch (not required): describe an alternative approach and say when it beats the obvious one.
Hints and extension
- First nudge: list W1's Monday incidents on a timeline before computing anything.
- If stuck after three minutes, write the input/output line you expect and trace the smallest example by hand.
- After the reveal, attempt the extension below before the next lecture.
- Extension challenge: write pseudocode that merges overlapping intervals for one system, then state the case where your merge order matters.