Book for learning algorithms in C++

Hello everyone,

I woud like to improve my coding skills in C++. I aready have a fairly knowledge of the language, but now I would like a book which basically focuses on how to implement algorithms in C++ from scratch, and which explains the ideas behind the construction of a C++ algorithm.

For example, I tried the book "Cracking the code interview", but I don't like that book too much, it is basically just a collection of algorithms with solutons and I find their hints either too general or too technical. Moreover, some codes are not in C++ really but in Java.

Which suggestions do you have? Please note that I am looking specifically for some book rather than website, online resource, ... etc.

Thanks for your ideas ;)
Last edited on
try this:

the art of computer programming - fundamental Algoritms
Knuth
@ar2007
I strongly disagree.

TAOCP is known for its quality, but it's not suitable as an introduction. Knuth's writing is through and rigorous, implementations are provided in an assembly language for a hypothetical computer. I can't critique the book for its material, but it's not designed as an introduction and using it as one would be difficult and probably overwhelming.

@OP
Someone scanned it. No guarantees as to legality, but have a look through and see what you think.
(Link removed)

---

My suggestion:
Pick up a copy of Cormen, Lieserson, Rivest, and Stein's Introduction to Algorithms. It's actually designed as a textbook; it's used in both undergraduate and graduate courses all over the place. Implementations are provided in procedural-styled psuedocode. It's not too slow of a read and is designed as an introduction. It's usable as a reference, and covers a much broader range of structures in much shallower detail than Knuth's volume 1 alone.

Someone scanned this one too. Same disclaimer:
(Link removed)
Last edited on
it was just an idea :)
And a good book too, and worth having! Just not as an introduction, in my opinion. :)
mbozzi thanks, but as I said I am looking for something specifically for C++. That is, a book on algorithms *in the C++ language* and not just algorithms in general.
If the implementation language must be C++, you should explicitly state that. I didn't catch that from the question, even after reading it again.

The algorithms themselves are obviously mostly language-agnostic.
I think that it was clear enough from the sentence "how to implement algorithms in C++ from scratch, and which explains the ideas behind the construction of a C++ algorithm." Is it there anything unclear about this sentence?
Is it there anything unclear about this sentence?

Yes. Algorithms are not specific to C++. Constructing an algorithm has very little to do with the language you eventually implement it in, so the ideas behind the construction of a C++ algorithm are the ideas behind the construction of an algorithm.

If you require help implementing an algorithm you understand in C++, you probably need to advance your knowledge of the language and not the algorithm. If you're having trouble understanding an algorithm, introducing a specific language into the mix probably isn't going to help your understanding greatly if you haven't already mastered the language.

Having some sort of reference to compare your implementation to may be helpful for debugging your implementation, but it would be difficult to find a common algorithm for which you couldn't google up an example in the language of your choice.
All: please be aware OP has a tendency to remove vital stuff from the thread once s/he gets a reply:
http://www.cplusplus.com/forum/beginner/208362/
Topic archived. No new replies allowed.