CHAPTER 9 Heuristics

THE FOLLOWING TRICKS and heuristics are not exactly mathematically

precise scientific methods. In fact, some of them sound pretty weird, but as Larry Constantine once remarked, a method is a list of things that tells you what to do next, when you did not know what to do next, and you hope the method at least gets you to a workable solution, if not a good solution.

Let me pick simple programming problems and apply these heuristics as we go along. Consider the “Dance Partner Problem” in which you are given a list of people and their gender. Your task is to pair them into couples.


Then there is the classic Orders problem: Given ...

Get Joe Celko's SQL Programming Style 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.