Notes - Programming Pearls

22 Jun 2014

Programming Pearls comes highly recommended from quite a few people. I am sucker for good books and I love owning highly recommended books. I own a lot of books on CS and quite a few photography books. So anytime I see someone recommending a book that I do not own - I gotta have it. :)


I am three chapters/columns into Programming Pearls but so far, the only column I really liked was “Aha! Algorithms”. The first column was on Bit Vectors that laid foundation for like-ness and the second column was very insightful. Some important points to keep in mind.

  • Anytime you come across “find” in context of integers (find that integer among a billion integers), think of binary search -> think how you can take the idea of partitioning (divide and conquer) at midpoint to reduce the problem input space
  • Think recursively - apply a solution on a smaller subset of input and check if you can apply the same recursively on rest of the input.
  • When you see anagrams - think about sorting (sort the characters in the word itself and then sort the words)

The next chapter on Data Structures was really about how one should think about structuring data in reusuable form. Those of us who has been programming for a while, might not see any bulbs light up.

At this point, my biggest complaint was the lack of adjustment of text. What I mean is that I understand the book originated from a set of columns written for a magazine and then converted to a book. And you have a 2nd edition with some revisions right? So why not just tune the text to remove words such as “two-pass algorithm in solution 5” - so this makes a first time reader ask - “what solution 5? Should I read something else I read the book? Like the preface?”. I am slowly getting used to these but was really disappointed to find such use cases quite a few.