Abstract:
The minimal reading list to become a good programmer.

Created 7 months ago by Peter Kankowski
Last changed 2 months ago
Contributors: Ace and Michael Weller
Filed under General

Reddit Digg Delicious Buzz Facebook Twitter

Recommended books and sites

Please add links to your favorite programming books with a short description.

The goal is to make a minimal reading list to become a good programmer. Feel free to discuss the listed books and propose better alternatives.

Algorithms

Math algorithms and optimization

Compression and encryption

Text processing

Compilers and Languages

C/C++

Functional programming

Operating Systems

Computer architecture

Software engineering

Usability

Code optimization

Computer graphics

Win32 programming

7 comments

ace, 2 years ago

I don't find that "Optimizing C++ by Steve Heller" should be in "a minimal reading list to become a good programmer". I consider it quite horribly written. The table of contest is argument for itself:

Prologue

A Supermarket Price Lookup System

A Mailing List System

Cn U Rd Ths (Qkly)? A Data Compression Utility

Free at Last: An Efficient Method of Handling Variable-Length Records

Heavenly Hash: A Dynamic Hashing Algorithm

Zensort: A Sorting Algorithm for Limited Memory

Mozart, No. Would You Believe Gershwin?

The book is my personal candidate for my "WTF" section ;>

The only O(N) sorting I know of is http://en.wikipedia.org/wiki/Radix_sort. The whole idea is: When the number of keys is small enough that we can count the number of occurrences of each key we can create the result with sorted keys in O(N) by first counting the keys an then constructing the result by storing count times each corresponding key value. This sentence is probably enough to replace at least one chapter from his book.

It's to icky for me to even try to understand what he presents in his book – confusing presentation of ideas, very ugly code for my taste (a typical guy whom I'd never take to program for me!). As I don't believe that he discovered anything new, I guess that his other ideas can also be explained in a few sentences per idea – no need to reading so ugly book.

I'd remove that book from this list. Of course, YMMV

Peter Kankowski, 2 years ago

Thanks, I've removed it. I agree that it's not good enough for the minimal reading list.

Radix sort can be used for arbitrary string keys; it works by counting individual characters in O(Nk) time, where k is the string length (usually a small constant). Sedgewick praises a hybrid algorithm (quicksort + radix sort), which showed impressive results in his benchmarks:

http://www.cs.princeton.edu/~rs/talks/strings.ps

What you described is http://en.wikipedia.org/wiki/Counting_sort, not Radix sort.

ace, 2 years ago

Yes you're right, radix sort is the generalization of counting sort, and I've described the counting sort. So I still must prove that "the whole idea" can be expressed shortly. So I've just stolen from the wikipedia a few sentences and modified them a little: Take the least significant group of bits (LS radix) of each key, then group the whole keys to leave them sorted by that radix, but otherwise keep the original order of keys (sorting must be "stable"). Repeat the grouping process with each more significant radix.

It can be a good exercise to try to describe some principle as short as possible without losing the important details. This also allows us to find the limits – it appears to me that counting sort would work efficiently for files much bigger than RAM (providing that counting of the keys fits in RAM of course), whereas radix can need potentially a lot of passes – so much that k in k * N is too big to be practical?

I'm still somewhat curious to learn what this guy described in the rest of the book (chapter titles certainly don't help much), but I'd really expect the short descriptions (or links to something else in better form).

(digression) I've taken a look at the "strings.ps". Benchmarks are for the computers of that time, MIPS and x86 machines, the fastest being MIPS R4400 on 150 MHz. My current router (ASUS WL-500g Premium) uses MIPS processor on 266 MHz taking only 12 W of power, total. If anybody stumbles to some sources and results of some complete benchmark which run on MIPS then I'd like to cross compile them and run them on WL-500gP. (/digression)

ace, 2 years ago

re radix sort, here's one implementation of radix sort over linked lists, I haven't checked details though: http://www.codersnotes.com/rsort/

Peter Kankowski, 2 years ago

IMHO, the shortest explanations are pictures:

Radix sort chart

Radix sorting is basically a counting sorting applied to each digit. The order of the digits can be MSD or LSD (most significant or least significant digit first).

I'm curious about the Heller's book, too :). Most of his optimizations are not very useful today, but he has some ideas I never found anywhere else.

Thanks for the linked lists example, it's a nice implementation (though, he should make shift a function parameter, not a template parameter).

Marat Dukhan, 2 months ago
I think this site worth adding to code optimization section: instlatx64.freeweb.hu
Contains measured CPUID dumps and latency/throughput of instructions for a large number of processors
Peter Kankowski, 2 months ago
Thanks, I've added it.
Your name:
Comment: