Lesson map
Lesson 15. Map, example, EX061.
flowchart TD
F["File stores F4 impact 2"] --> P["Printed score 4"]
H["A notebook tries impact 3"] --> N["That product would be 6"]
N --> D["The embedded print stays the file"]
The hypothetical is a different tuple. The fenced output is this tuple.
Logical drawing
on disk
F4 impact 2
score 4
third printed line
not on disk
impact 3
product 6
id order among the sixes
Learning outcomes
After this chapter, you should be able to:
- Read F4's impact from the tuple that was actually sorted.
- Compute the product if that impact were 3.
- Refuse to replace the embedded print with the hypothetical.
15.1 Impact 2 is what sorted saw. Impact 3 is a different key.
The stored F4 tuple ends in 2, 2. Likelihood 2 times impact 2 is 4. The key is (-4, "F4"), which sits between the sixes and F2. The third printed line is that result: F4 score=4 medium.
If the last integer were 3, the product would be 6 and the key would be (-6, "F4"). Three keys would then start with -6, and the id strings would order them F1, F3, F4, with F2 still last on product 2. That order is a calculation about a tuple this file does not hold. Pasting it under the lab's output fence would report a run that did not happen.
Lesson table; scroll horizontally to read all columns →
| Impact stored | Product | Place in the embedded print | |
|---|---|---|---|
| F4 as written | 2 | 4 | Third line |
| F4 with the last integer replaced by 3 | 3 | 6 | Not a line in this file |
15.2 Worked example
Lesson table; scroll horizontally to read all columns →
| Offered page | Matches the file? | Decision |
|---|---|---|
| F4 on the third line at score 4 | Yes | Keep |
| "F4 now ties the sixes, so quote that as the lab." | The file was not edited | Refuse |
| "Delete F4 from the list so the tie goes away." | The tuple stays | Refuse |
Synthetic case. One ranking print. The alternate impact stays in the notebook.
Errors and limits
Do not overwrite the embedded F4 line with the alternate product.
Apply
- EX061 — Unprinted change. What does this file print for F4, and where would F4 sit if its impact were 3?
Show marking criteria
Rubric: 3 = the file prints score 4 in third place; impact 3 would make product 6 and the id order would be F1, F3, F4, then F2; that order is not the embedded print;; 2 = score 4 is the print and the alternate is not;; 1 = one score;; 0 = none.