Skip to main content

Mistake Clinic

Module-Specific Mistake Radar​

SymptomUnderlying errorSmall falsification
Sorted keys but reordered tiesCompared payloads or chose the right merge head on equalityTwo equal keys with distinct tags
Search returns any matching duplicateWrong output contractThree equal keys and a boundary query
Search stallsNo strictly shrinking intervalOne-element active interval with lo=mid
Random-pivot quicksort is quadratic on tiesEqual keys all sent to one recursive sideAll-equal array
Selection called worst-case linearExpected bound used as a guaranteeExtreme pivot sequence
Deleted neighbor becomes unreachableEmpty and deleted states conflatedCollision chain; delete its first entry
Old map value reappearsInserted at tombstone before finding existing keyDelete head, update later key, delete it
Low-load map is slowDeterministic collision family ignoredMultiples of capacity
Heap construction analysis is n log nCharged root height to all nodesHeight-sum derivation
Merge exhausts memoryFlattened inputs or retained all output internallyGuarded generators and source inspection
External-sort time is halvedCounted merge but omitted run generationRead/write ledger for every stage
Radix allegedly sublinearDropped pass ceiling and input traversalFixed-width keys still require one pass

Practice Mistake Checks​

For P1–P4, verify stability, multiplicity and model assumptions separately. For P5–P8, write bounds and rank conventions before code. For P9–P12, use operation histories and name the probability space. For P13–P16, price input/output and retained state rather than only the central loop.

Record a real failure, the smallest reproducing input, violated invariant, repair, and fresh successful case. A copied fix without an explanation remains incomplete. Use Practice Solutions only after preserving your attempt.