This blog post lists the best books I can recommend to students who want to learn how to program. Please note that programming is more about doing than reading, see Message to the students for a more general picture.
Basics not tied to a specific programming language:
- Absolute beginners should follow the Message to the students guide first, and finish some online courses about programming.
- Rivest et al.: Introduction to Algorithms, 3rd edition.
- Henry S. Warren, Jr: Hacker's Delight, 2nd edition. Chapter 2 (one of the best chapters) is available for download for free.
- Donald E. Knuth: The Art of Computer Programming, Volume 1, Volume 2, Volume 3.
- Brian W. Kernighan and Rob Pike: The Unix Programming Environment, 1984.
- Steve McConnell: Code Complete, 2nd edition.
Basics for some important programming languages and technologies::
- Python: Mark Lutz: Programming Python, 4th edition.
- C: Brian W. Kernighan and Dennis M. Ritche: C Programming Language, 2nd edition (1988).
- C++: Bruce Eckel: Thinking in C++, 2001, Volume 1, Volume 2, also free to read online.
- Java: Bruce Eckel: Thinking in Java, 4th edition (2006), very old editions also free to read online.
- Haskell: Miran Lipovača: Learn you a Haskell for Greater Good, also free to read online.
- Tobi Oetiker: The Not So Short Introduction to LaTeX2e, free to read online, updated continuously.
- Scott Chacon: Pro Git, also free to read online.
- Brian W. Fitzpatrick et al.: Version Control with Subversion, also free to read online.
Gems specific to programming languages and technologies beyond the basics: