Note: The mercurial server is disabled at the moment while I investigate whether it can run with an acceptably low CPU load – Mike.
Course outline (Imperative Programming)
This page gives an outline of the course, supplemented by links to the handouts and problem sheets, and source code for the example programs.
- I will not be using slides, and I will not be handing out a transcript of each lecture, but only a very brief handout, typically containing the text of programs that are discussed in the lecture. Students will be expected to attend the lectures and make their own notes. For help in revision, there is a fuller set of lecture notes from a previous year.
- Each problem sheet contains problems on all the material up to the place it appears in this outline, but you should be able to do at least some of the problems before we have finished all the lectures up to that point. I shall be handing out a complete set of problem sheets in a lecture near the start of the course.
- Source code is given for the example programs that are used in the lectures.
Introduction
[1] Slow and fast exponentiation: handout. A second handout.
[2] Printing numbers in decimal: handout.
[3] Method of invariants and proof of termination; String comparison: handout.
[4] Repeat, loop and for statements; introducing Lab 1: handout.
- Source text of program L0Total.m.
- Source text of programs L1Slow.m, L1Fast.m, L1Time.m.
- Source text of program L2Print.m.
- Source text of program L3Find.m.
- Problem sheet 1.
Programming with procedures
[5] Procedures and parameters: handout.
[6] Binary search: handout.
[7] Quicksort: handout. Another handout.
[8] Lab 3 – longest ascending subsequence: handout.
- Source text of program L7Sort.m.
- Problem sheet 2.
Modules and pointers
[9] Modules; pointer-linked structures: handout.
[10] Operations on linked lists: handout.
[11] Doubly-linked lists and priority queues: handout.
[12] Implementing Dijkstra's algorithm: handout.
- Source text of modules L9Store.m, L9Main.m.
- Source text of modules L10Store.m, L10Main.m.
- Problem sheet 3.
Implementing data structures
[13] Hash tables: handout.
[14] Binary trees: handout. Also a supplementary note about removing recursion from in-order traversal.
[15] Dancing links: handout.
- Source text of module L13Words.m.
- Source text of module L14Words.m.
- Source text of module Pento.m and script pentovision.
- Problem sheet 4.
- ↑ Please don't think that I worship the fetish of numbering everything from zero in everyday life: it's just that I decided to add an extra lecture at the start, and didn't want to renumber everything else.