Tuesday, June 20, 2017

Algorithms in a Nutshell: A Practical Guide

A programmer wanted to prevent memory leaks, so he wrote some code to store a record of all memory allocated and freed. However, this code resulted in the programs sometimes taking forever to run. Only after some analysis, it was determined that the binary tree used for storing memory locations was unbalanced, due to the sequential nature of memory allocation in malloc. Balancing the tree reduced the horrible worst-case run times.
This story lead to the promise of a great, practical book on algorithms. Alas, after starting off well, the book soon went of the deep end. Rather than providing simple algorithms to answer real world questions, it dove into deep analysis of algorithms with multiple tables of timings. (Hint: do not use text to speech unless you want to hear endless pronunciations of large numbers.) It went to provide very detailed analysis of implementations of certain algorithms on various platforms. Alas, it only covered a limited number of specific algorithms in this detail. It also went on to cover in significant depth some algorithms with limited use cases. The detail was both too much for a general "nutshell" view of algorithms and not nearly enough for a detailed reference book.

No comments:

Post a Comment