Why Can Occasional Expensive Operations Still Permit Efficient Growth? Trace the cost of every operation in a growing data structure, then prove a bound on the total cost of the sequence. An occasional large operation does not automatically make every operation expensive. Conversely, a small amortised cost does not guarantee that the next individual operation is cheap.
This international lab extends the Computational Cost, Dynamic Programming, Loop Invariants and Queue and Waiting-Time Labs using fictional array operations. Vocabulary Coding and Engineering (VCE) and EnDist are proposed educational frameworks, not validated interventions. The examples use an explicit cost model, not measured system performance; future superintelligence remains hypothetical.
- Declare what counts as work and distinguish size from capacity.
- Trace geometric and fixed-increment growth.
- Calculate total writes, copies and cumulative average cost.
- Prove a sequence-wide bound independently of probability.
- Separate amortised work from worst individual operation cost.
- Transfer the analysis to a changed starting capacity.
Choose your reading route
Coursework series: Computational Cost Lab · Dynamic Programming and Subproblem Lab · Loop Invariants Lab · Queue and Waiting-Time Lab · Vocabulary Coding and Engineering
Continue this coursework series: Amortised Cost and Resizing Lab (this article) · First-Passage and Hitting-Time Lab · Missing Data and Denominator Lab · Nominalisation and Agency Studio
Full chapter index
Chapters 1–5
Chapters 6–10
Chapters 11–15
Chapters 16–20
Chapters 21–25
Chapter 26
CHAPTER 1 OF 26 · Understand the capability
1. The capability: count the whole sequence
A fictional archive receives a stream of labelled cards. A register with fixed storage must occasionally be moved into a larger register before the next card fits. Some insertions need one write; others require copying every previously stored card. A learner who sees a single expensive copy might mistakenly conclude that every insertion is equally costly.
This lab compares growth rules by reconstructing the entire operation sequence and proving a bound that applies to any permitted prefix. The deliverables are a trace, a cost model, a mathematical certificate and a fresh transfer. The analysis is about abstract work units, not elapsed seconds.
CHAPTER 2 OF 26 · Understand the capability
2. Define size, capacity and cost
Size is the number of occupied positions. Capacity is the number of available positions, including occupied ones. The array begins empty with capacity one. Appending when free space exists writes one new entry. When full, allocate a larger array, copy all existing entries, then append.
Count each copy or new-entry write as one work unit. Ignore allocation overhead, freeing memory, input acquisition and all other implementation costs. This explicit model makes the arithmetic reproducible. A system’s actual runtime or memory consumption may require additional modelling.
Background reading: Cornell: amortized analysis and dynamic tables · Cornell: amortized algorithms and array doubling.
CHAPTER 3 OF 26 · Understand the capability
3. Vocabulary Coding and Engineering for efficiency
Distinguish individual cost, worst individual cost, total sequence cost, arithmetic average over a particular trace and amortised bound. Amortised analysis establishes a sequence-wide guarantee without assuming random inputs. It is not the same question as an expected cost under a probability distribution.
Under proposed VCE, attach the unit, operation class, starting state and growth policy to every efficiency statement. A claim such as constant amortised cost is incomplete unless the sequence and cost assumptions are known. This helps another reader check the scope instead of repeating a complexity label.
Related framework: Vocabulary Coding and Engineering.
CHAPTER 4 OF 26 · Work through the example
4. Read the fictional doubling policy
Start at size zero and capacity one. Before appending to a full array, replace capacity c with 2c, copying all c existing entries. There are no deletions, shrink operations or modifications to previous cards. Appends are attempted in sequence until nine entries have been stored.
The rule is complete for this exercise. Since the previous array is full at a resize, the number copied equals its old capacity. New entries always require one write even on a resize step. We will separately change the growth rule while retaining the same cost units.
CHAPTER 5 OF 26 · Work through the example
5. Trace the first four appends
Append one writes into the original empty position, costing one. Append two finds capacity one full, copies one and writes the new entry, costing two and raising capacity to two. Append three copies two and writes one, costing three; capacity becomes four.
Append four uses spare capacity and costs one. The cumulative cost after four appends is seven. The array contains four entries. Verify that the size increases by one at each step and that a resize changes capacity but does not duplicate logical entries.
CHAPTER 6 OF 26 · Work through the example
6. Trace the nine-append register
Append five copies four entries and adds one, costing five. Appends six, seven and eight each cost one. Append nine finds capacity eight full, copies eight and writes one, costing nine; the new capacity is sixteen.
The nine individual costs are 1,2,3,1,5,1,1,1,9. Their sum is 24. This includes nine mandatory new writes and fifteen copies. The largest single cost in this prefix is nine, whereas the arithmetic mean is 24/9=8/3.
| Append | Capacity after | Copied | Cost |
|---|---|---|---|
| 1 | 1 | 0 | 1 |
| 2 | 2 | 1 | 2 |
| 3 | 4 | 2 | 3 |
| 4 | 4 | 0 | 1 |
| 5 | 8 | 4 | 5 |
| 6 | 8 | 0 | 1 |
| 7 | 8 | 0 | 1 |
| 8 | 8 | 0 | 1 |
| 9 | 16 | 8 | 9 |
CHAPTER 7 OF 26 · Work through the example
7. Separate copying from original writes
Every successful append supplies exactly one new entry, so n appends always contribute n new-entry writes. The remaining work is copying during expansion. For the nine-entry case those copy counts are 1,2,4 and 8.
Their sum is fifteen, not sixteen. The final capacity sixteen is not a count of previously copied entries. Recording copy and new-write columns separately prevents learners or AI from charging the final unused positions as if they had contained old cards.
CHAPTER 8 OF 26 · Work through the example
8. Prove the geometric aggregate bound
For n≥2, let C be the smallest power of two at least n. Resize copies sum to 1+2+4+…+C/2=C−1. This follows from the finite geometric series or by doubling the sum and subtracting. Since C/2<n, we have C<2n.
The total cost is n+C−1, strictly below 3n. For n=1 the cost is one, also below 3n. Therefore every positive-length append prefix from the declared empty state has average cost below three work units. This is a deterministic amortised bound, not an estimate from a sampled trace.
CHAPTER 9 OF 26 · Work through the example
9. Use a cumulative credit certificate
Charge three abstract credits per append and pay the actual work units from the running balance. After n appends the balance is 3n minus the total cost. Our aggregate proof shows this balance never becomes negative for any prefix.
For nine appends the balance is 27−24=3. This is an accounting witness, not actual money or stored processing power. It demonstrates why a costly expansion can be paid for within a fixed per-append charge. The initial zero balance and declared cost convention matter.
| n | Total work | Charge 3n | Balance |
|---|---|---|---|
| 1 | 1 | 3 | 2 |
| 2 | 3 | 6 | 3 |
| 3 | 6 | 9 | 3 |
| 4 | 7 | 12 | 5 |
| 5 | 12 | 15 | 3 |
| 8 | 15 | 24 | 9 |
| 9 | 24 | 27 | 3 |
CHAPTER 10 OF 26 · Identify failure modes
10. Detect a misleading efficiency claim
A generated report states that append costs at most three writes because its amortised bound is three. Append nine contradicts this individual bound: it costs nine writes. The true guarantee concerns the total cost of every permitted prefix.
Repair the statement to say that n appends from the declared empty array take fewer than 3n counted writes, although an individual append may cost size plus one. A latency-sensitive task may still need to account for the expensive operation. Do not equate an aggregate guarantee with an individual deadline.
CHAPTER 11 OF 26 · Identify failure modes
11. Compare a fixed-increment policy
Change the rule to increase capacity by one whenever full. Starting capacity remains one. On the kth append, k−1 previous entries must be copied if k≥2, so total cost for that append is k.
For nine appends, the costs are one through nine, summing to 45. In general the sum is n(n+1)/2. The average is (n+1)/2, which grows with n. Unlike doubling, this policy does not have a constant bound on counted writes per append across every prefix.
CHAPTER 12 OF 26 · Identify failure modes
12. Check equal objectives before comparing
Both policies store exactly the same nine entries and preserve their order. Doubling uses 24 work units; increment-by-one uses 45. The comparison concerns the same starting size, append count and write-based objective.
Their final capacities differ: sixteen versus nine. Doubling saves counted copies at the cost of extra unused positions in this instance. Do not declare it universally preferable without considering memory or latency requirements. Those would be separate objectives.
| Policy | Copies | Writes total | Final capacity |
|---|---|---|---|
| Double | 15 | 24 | 16 |
| Add one | 36 | 45 | 9 |
CHAPTER 13 OF 26 · Identify failure modes
13. Distinguish occupied positions from allocated space
For the doubling policy at n=9, size is nine and capacity sixteen, so seven positions are unused. At n=8, size and capacity are both eight. Both statements are exact under the stipulated policy.
A resize may temporarily require old and new storage simultaneously. If the implementation retains the old eight positions until copying into sixteen finishes, the combined capacity can be twenty-four during that expansion. This is a conditional storage observation, not an empirical memory benchmark.
CHAPTER 14 OF 26 · Identify failure modes
14. Check boundary cases
An empty sequence costs zero, so do not divide by zero to report its per-append average. A single append costs one, without expansion. At n=8, the copy total is 1+2+4=7 and total work is fifteen.
The next append brings the copy total to fifteen and total work to twenty-four. A sharp increase in prefix cost at a boundary is consistent with a linear upper bound. Check both sides of a resize when testing a generated formula.
CHAPTER 15 OF 26 · Identify failure modes
15. Preserve the starting-state contract
If an array begins already full at capacity 100, one new append in our model costs 101 writes. This does not refute the proved bound for appends starting empty at capacity one. The initial state has changed, and earlier operations may not be included in the counted sequence.
A new bound should explicitly account for initial stored contents or an appropriate accounting balance. The old proof cannot simply be reused without changing its assumptions. This is an example of why transferable mathematical knowledge must retain its boundary conditions.
CHAPTER 16 OF 26 · Identify failure modes
16. Separate a proof from a benchmark
A Python demonstration, spreadsheet or simulation can verify the first several rows. Such a trace does not prove the bound for every n. The geometric argument provides the general certificate under the cost model; the trace checks that the example follows the rule.
Actual timing can include allocation, data representation, cache behaviour, copying machinery and other work. An AI-generated complexity claim is not a measured result on particular hardware. Use an appropriate independent experiment if runtime measurements are required.
CHAPTER 17 OF 26 · Identify failure modes
17. Audit a generated cost report
Suppose an assistant counts only the four resize operations and nine appends, obtaining thirteen work units. It has treated a resize as one unit rather than counting the entries copied. Under the declared model, the copy total is fifteen and the complete total is twenty-four.
Require the assistant to return the old capacity, new capacity, entries copied, original write and cumulative cost at each step. Inspect append five and append nine independently. An apparent discrepancy may reflect a different cost model rather than incorrect arithmetic, so make that distinction explicit.
CHAPTER 18 OF 26 · Identify failure modes
18. A prompt for an inspectable growth analysis
Try: Begin empty with capacity one. Append nine entries, doubling only when full. Count each copied entry and each new write as one unit. Produce the complete table, then prove the aggregate bound for arbitrary n≥1 using a geometric series.
Continue: compare increasing capacity by one, state both final capacities and explain why amortised cost is not worst-case individual cost. Test the boundary n=8 and n=9. Keep model work units distinct from runtime and do not claim actual performance without evidence.
CHAPTER 19 OF 26 · Identify failure modes
19. A proposed assessment rubric
Score five dimensions from zero to three: state and cost definitions; accurate trace; justified general bound; comparison of individual work and total work; independent changed-policy transfer. Zero indicates absent evidence, one substantial errors, two mostly correct with a gap, three independently reproducible reasoning.
Record an AI-assisted table, the learner’s independent derivation and another recipient’s reconstruction separately. Preserve ordinary access supports and provide feedback about specific missing reasoning. Maximum fifteen is a classroom proposal, not a validated measure of computing proficiency or intelligence.
CHAPTER 20 OF 26 · Test independent transfer
20. Independent transfer: initial capacity two
Start empty with capacity two and append eleven entries. Compare doubling with adding two capacity positions each time the array is full. Calculate the resize steps, total copies, total work and final capacities before reading the check.
Worked check: doubling resizes at appends 3,5,9, copying 2+4+8=14; work is 11+14=25 and capacity sixteen. Adding two resizes at 3,5,7,9,11, copying 2+4+6+8+10=30; work is 41 and capacity twelve. Explain the differing storage slack and worst individual costs (9 and 11).
CHAPTER 21 OF 26 · Test independent transfer
21. Primary learning: move paper cards into larger trays
Use adult-prepared paper trays with labelled slots. Children add cards and move them to a tray with twice as many slots when full. Count each moved card and each newly placed card as one action. Use small numbers and accessible tactile or verbal representations.
Compare expanding by one slot with doubling, then ask why a large move can make later insertions easier. Formal asymptotic notation can wait. The transferable idea is counting repeated work rather than judging the whole process by one conspicuous step.
CHAPTER 22 OF 26 · Test independent transfer
22. Secondary learning: connect sums and growth
Students can tabulate costs, identify powers of two and derive the geometric sum. Compare the quadratic fixed-increment total with the linear doubling bound under the same cost definition. Require a boundary test just before and after an expansion.
Introduce basic algorithmic notation only when readiness permits. Have learners explain the difference between an individual operation and a sequence. A spreadsheet can support checking, but students should justify the bound without relying on the generated chart.
CHAPTER 23 OF 26 · Test independent transfer
23. University, institutions and EnDist
Advanced work may investigate accounting and potential methods, changing allocation strategies and data structures supporting mixed operations. Additional operations can alter the argument; neither this proof nor the toy trace certifies any production implementation.
Under proposed EnDist, an efficiency result becomes more useful when the receiver obtains the cost definition, input boundary, proof and test trace. Distinguish assisted computation, independent learner capability and successful reuse by another team. These are proposed practices, not measured intelligence growth.
CHAPTER 24 OF 26 · Four-week coursework plan
24. A four-week coursework sequence
Week one: define array size, capacity and work units, then trace nine appends. Week two: prove the geometric aggregate bound and construct the credit certificate. Keep the table and proof together for independent checking.
Week three: compare fixed increments, memory slack and starting-state changes. Week four: give the fresh transfer before its answer and assess learner and recipient reconstruction separately. Adapt pacing and access supports; the sequence is proposed, not validated instruction.
CHAPTER 25 OF 26 · Four-week coursework plan
25. Questions about amortised cost
Does constant amortised cost mean every append is constant-cost? No. Does amortised analysis require a random sequence? Not for this deterministic guarantee. Does counting one resize as one operation establish the number of entries copied? No; the cost model matters.
Does the doubling proof automatically apply to deletion and shrink policies? No. Does the faster counted growth policy always use less memory? No; inspect capacity and temporary storage separately. Keep the objective and assumptions attached to the result.
CHAPTER 26 OF 26 · Four-week coursework plan
26. Sources, boundaries and next steps
Cornell’s course notes supply background on amortised analysis and geometric growth. All registers, numerical traces, changed-policy cases and assessments here are original fictional teaching constructions. The simplified model does not represent measured runtime or prove educational effectiveness.
Next, design an alternative growth rule, trace a small prefix and attempt a valid total-work bound. Give a recipient the operation contract and ask them to check a resize boundary. The enduring capability is reasoning about the accumulated cost of intelligence-assisted work without confusing it with an individual operation’s cost.
References: Cornell: amortized analysis and dynamic tables · Cornell: amortized algorithms and array doubling.
Related coursework: Computational Cost Lab · Dynamic Programming and Subproblem Lab · Loop Invariants Lab · Queue and Waiting-Time Lab.