Algorithms - Data Structures Book

Started by
9 comments, last by alvaro 10 years, 2 months ago

Sedgewick has had many incarnations of his "Algorithms" book over the years, and any of them will do just fine. The particular language in which the code pieces are written is almost irrelevant.

My impression is that the C++ versions of the book are a horrible place to learn C++. You can see the code for Algorithms in C++, Parts 1-4 (Fundamental Algorithms, Data Structures, Sorting, Searching) here. The code is really bad C++:

* It uses obsolete headers like <iostream.h>

* It declares all variables at the beginning of the function, instead of at the point where they are first used.

* It passes collections of things by pointer-to-first and size (in perfect C style) instead of using iterators.

* It uses macros in questionable ways

* It uses uninformative variable names (to the point that the code is almost unreadable without the accompanying chapter).

In short, it looks like he took the C version, replaced `printf' with `cout' and little else.

This topic is closed to new replies.

Advertisement