Department of Information Technology

AD2 Software & Coding Convention

No programming language will be used in this course. All algorithms must be expressed in imperative programming pseudocode, using the language and formatting used in the CLRS textbook (see pages 15-16 and 19-20). For best results in the assignment reports, it is strongly recommended to use LaTeX2e, together with the clrscode package (see Resources).

Every algorithm must be prefixed with its specification:

  • the names of the arguments & results, and their types
  • the pre-condition on the arguments
  • the post-condition on the arguments & results
  • optionally: illuminating examples and counter-examples of argument-result pairs

Every loop and recursion must be commented with:

  • the loop / recursion variant (a quantity that decreases at every iteration according to some well-founded order)
  • optionally: the loop invariant (a statement that is true at the start of every iteration; see pages 17-18 of CLRS)

Every new data structure must be commented with:

  • the representation convention (an explanation of how to interpret the contents)
  • the representation invariant (a statement that is true before and after every modification)

Examples and further advice on such annotations can be found here.

Updated  2009-09-10 15:42:38 by Pierre Flener.