8

Experiments with Algorithms

Often the best way to understand how something works is to build a small version and do some experiments. This is particularly true for algorithms: writing code illuminates and clarifies issues that are too easily glossed over with pseudo-code. Furthermore, the resulting programs can be tested to ensure that they behave as advertised, which is not true of pseudo-code.

Awk can be a good tool for this kind of experimentation. If a program is written in Awk, it’s easy to concentrate on the algorithm instead of language details. If the algorithm is ultimately to be part of a larger program, it may be more productive to get a prototype working in isolation first. Small Awk programs are also excellent for building a scaffold ...

Get The AWK Programming Language, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.