Traditionally programming is considered as something practically important but very boring, something like looking for errors in long unreadable non-working programs. However, it is quite possible to learn how to write short and elegant programs when they exist; the key idea is that you try to construct a program together with the proof of its correctness. We will try to show you this technique using many examples (from Dijkstra, Gries, and other books). At the same time we will learn some techniques for constructing effective (fast) algorithms.
- Basic constructions. Variables, assignments, loops, invariant relations.
- Arrays. General scheme of one-pass algorithms.
- Generation of combinatorial objects. Tree traversal, backtracking.
- Finite automata.
- Sorting and related problems.
- Data structures: stacks, queues, etc.
- Sets and their representations. Hashing, trees, balanced trees.
- Algorithms on graphs.
- Recursion: how to use it and how to replace it by iteration.
- Context-free grammars, recursive parsing.
- LL(1), LR(1) parsers.
- A. Shen, Algorithms and programming: theorems and problems, Birkhauser, 1997.