Handout on tracing algorithms (pseudo-code)