Some ideas on how to go about solving the problem. Includes some pseudocode.
No download links available.