How to write documentation for COMP 40

Avoid these common mistakes:

Here is what I expect:

Invariants, contracts, and algorithms

Remember that an invariant is a claim whose truth can be checked at a single point in time.

The contract for a function describes two points in time: just before the function is called and just after it returns.

If you write a narrative description of a sequence of events in time, that is not an invariant or a contract: it is a description of an algorithm. Very rarely in COMP 40 is it useful to document an algorithm---if you tell me the data structures, their invariants, and the contracts of the functions, the algorithms are obvious.

Good invariants