Hacker News new | ask | show | jobs
by ballstothewalls 4576 days ago
I recently graduated with a degree in math but not much programming experience (I am pretty familiar with Mathematica but nothing else). I was thinking about picking up an intro to CS book to begin learning CS. Would this book be good for this? Should I even bother with CS theory or just jump into using a language?
13 comments

To put it in math terms, using TAOCP for an intro to computer science would be like using Russell and Whitehead for an intro to arithmetic.
On the other hand, if you wanted to recreate modern Computer Science from scratch, without knowing it (e.g. all the programmers died from a zombie plague and you need to stop an alien invasion; or you're stuck on a desert island with a computer and lots of batteries and know that if you can program a new wireless radio driver you can put out enough interference to catch a plane's attention) and TAOCP was the only book that was accessible, it might be enough.
It depends on what you want. I've only read the first volume so far, but I would say that it's definitely appropriate for an intro to CS since you have the math background. I would definitely not recommend it to most people since the math is pretty dense and not all necessary (though very interesting). If you're familiar with combinatorics and stats, then it won't be too bad.

As a CS book, it teaches a lot of good CS concepts and techniques very thoroughly, and it analyzes the performance of algorithms very precisely. You'll not only use Big O notation, but you'll also figure out some of the constants. So, if your interest is in computer science proper, then this is a great introductory book.

On the other hand, if your goal is to be able to write programs, then definitely jump into using a language. Go find a book on a language and just start using the language to solve problems. After you get past the basics of programming, you'll start to see all the applications to math (especially discrete math). I've heard Structure and Interpretation of Computer Programs is a good book, and I plan to read it next semester, so maybe that's a good one for you. It uses Scheme (a Lisp) as the programming language, so the parallels with math are very clear.

As you said, it's dense. Enough so, that few people will read it cover to cover sequentially.

It's challenging, where "challenging" means that it requires living with some bewilderment and frustration while reading it. And anyone who is not as smart and knowledgeable as Knuth will probably experience both to some degree because what makes tAoCP great is that Knuth doesn't dumb anything down.

Over the years, I've found that tAoCP works well without having to dig deeper into the math [or MIX] than I am able or interested in diving...the abstractions are laid out well and understandable as abstractions without getting buried in algorithmic analysis...though the analysis can be interesting.

My take is that if someone is serious enough to try to tackle it, it will give back more than the effort put in regardless of the person's computer science background.

Read this: http://mitpress.mit.edu/sicp/full-text/book/book.html -- think most will agree with me.
These are HN favorites, along with K&R - I wouldn't recommend any of them to beginners no matter what their background is.

Instead I'd suggest a good succinct explanation of Big O notation to be digested and promptly forgotten (anybody who studied calculus should have intuition for it anyway, it just nicely ties in to the "cost" of the code they'll produce) and straight to scripting in Python with them. :)

K&R is not a good book to learn how to program from. SICP on the other hand is[1], it teaches how to create abstractions among other things. K&R just shows you how C works. Also, this person has a deep understanding in mathematics and should have no problems digesting an introductory book, such as SICP, at all.

[1] http://www.eecs.berkeley.edu/~bh/sicp.html

I really like Winston and Horn's Lisp. It actually is written assuming you don't know how to program at all, but quickly moves along into more complex stuff, really showing off what Lisp can do. Winston teaches (taught?) at MIT, and when the book was first written I guess it was still a reasonable possibility that you could be a freshman at MIT in computer science and have never programmed before.

http://www.amazon.com/Lisp-3rd-Edition-Patrick-Winston/dp/02...

Interesting book, thanks for the info! Will take a look.
As much as I love SICP I have to say that I think that its biggest power is showing a different way to view programming. Unless you already know the basics its hard to appreciate it.
PDF versions for computer and font/size adjusted version for e-book/tablet are here: http://sicpebook.wordpress.com/
> I was thinking about picking up an intro to CS book to begin learning CS. Would this book be good for this?

No, absolutely not.

Buy the Knuth book. You can get it used for ~$25 on Amazon, and if it gathers dust or you dislike it, sell it and buy something like Programming Collective Intelligence for some fun motivating problems and to learn Python.

In Knuth's book you learn about and work with the details of how computers work that Mathematica handles itself and explicitly hides from you. If you ever wondered, for example, how Mathematica might store a matrix in memory, or why when you evaluate 1/.99999 it returns .00001, but if you add one more 9 to the denominator it returns 1., then Knuth's book is a good one to turn to.

Knuth does not use a high-level language to describe computations--instead he uses a made-up computer called the MIX 1009, which has its own machine language. He came up with 1009 by taking 16 of the machines at the time and taking the average of their numbers (360, 650, 709, 7070, U3, SS80, 1107, 1604, G20, B220, S2000, 920, 601, H800, PDP-4, and II) He also points out that you can derive the same number by taking the name as Roman numerals. If that makes you laugh, you will also find it to be a deeply funny book.

This is definitely not usable as an early intro to CS book, as it's pretty dense. There's a wide variety of introductory material that you can pick from, depending on your interests (what kind of stuff are you interested in doing). But TAOCP is aimed at someone a bit more advanced. Since you have a math background though I think you could give it a shot and see how far you get.
Do you want to learn computer science or programming? The two are only tangentially related.
tAoCP is not just a computer science book, in a sense It is part of the foundation for the field. That said, it is not so much theoretical as it is descriptive. In it [or them] Knuth describes algorithms. and programs and the mathematics of their execution. The sort of code described is for the things people use every day.

It's good reading if a person is fascinated by the subject. Otherwise it will be very very dry. Among the otherwise's, would be someone hoping to pick up a language or someone who wants an introduction to programming. With a math degree, you should not struggle with the math.

These books are good for humbling people who think they know a lot about computer science. They are definitely not good for introducing people to computer science.
Don't use this series as your introduction.

Knuth attempts to build the discipline more or less from the ground up, using a mathematical perspective, and he actually more or less succeeds. The resulting books are awesome as references, but they're incredibly information-dense: not beginner-friendly at all.

If you are coming from mathematics and want to learn programming, you should pick a language first and learn to compile, run, and debug it. Then just about any introductory programming text would serve you fine.

But learning computer science can be much different than learning software engineering. If you want to learn algorithms analysis, I would suggest you read, in order, Sipser and then pick and choose parts of CLR+S. This will give you a good overview of what is important and how proofs of correctness and complexity analysis are done.

Can't speak to this particular book, as I haven't read it, but the best starting point for you depends what you want to learn CS for - do you want to build apps, or do research, or dabble in a bunch of topics just for the sake of learning, or something else entirely? The basics of CS "theory" (ie. Big O notation, searching/sorting algorithms, etc) are useful for any programmer - but beyond that, there are many directions you can take.
What do you want to learn? Programming or CS? CS is more than just programming, and CS theory is more than just Algorithms & Data Structures.

If you want to learn about Algorithms and Data Structures and you have a strong math background, then CLRS is the book to get: http://www.amazon.com/Introduction-Algorithms-Thomas-H-Corme...

An undergraduate CS curriculum will mostly cover the parts I-VI of the book (that's around 768 pages) plus a few chapters from the "Selected Topics Chapter" (we covered Linear Programming and String Matching). Mind you, this book is very theoretical, and all algorithms are given in pseudocode, so if you don't know any programming language, you might have to go with a an algorithms textbook that is more practical. In my DS course we had to implement a Red-Black tree and a binomial heap in Java, and in my Algorithms course we only wrote pseudocode.

Maybe Sedgewick's (Knuth was his PhD advisor!) "Algorithms (4th ed)" will be a better choice for a beginner, as it shows you algorithm implementations in Java: http://www.amazon.com/Algorithms-4th-Edition-Robert-Sedgewic... (If you decide to go this route, you might as well take his two Algorithms courses on Coursera, they will really help).

There are also a bunch of Python-based introductions to computer science which have a broader focus than just teaching specific data structures and algorithms. Some of them emphasize proper program design, debugging and problem solving. I haven't read any of them, so I can't vouch for them, but here are a few of the more popular ones:

* http://www.amazon.com/Introduction-Computation-Programming-U...

This book was written to go along with John's edX course: https://www.edx.org/course/mitx/mitx-6-00-1x-introduction-co...

* http://www.amazon.com/Python-Programming-Introduction-Comput...

Oh and btw, there's also the Theory of Computation, which is a major part of CS theory. Here are a few MOOCs and recommended books on the subject:

MOOCS:

* https://www.coursera.org/course/automata

* https://www.udacity.com/course/cs313

Books:

* http://www.amazon.com/Introduction-Theory-Computation-Michae...

Sipser's book is probably the best introduction to the theory of computation, and I believe its last chapter deals with Complexity theory as well.

* http://www.amazon.com/The-Nature-Computation-Cristopher-Moor...

I loved this book very much. It has a very informal and conversational style (don't let it fool you, the problem sets can be HARD).

* http://www.amazon.com/Computational-Complexity-A-Modern-Appr...

Once you are familiar with some computation models, its time to study computational complexity and this is one of the best books on the subjects. It is used both for graduate and undergraduate courses.