306 points · by bjackman · 7y ago · 82 comments
It seems to me like she's a member of a large and growing target audience for a book that gets you started with all the stuff you would learn in a computer science degree, with the assumption that you already know how to express an algorithm as code.
Can anyone recommend such a book?
The entire book -- including the portions labeled Models of Computation, Director's cut, and Extended Dance Remix -- presents accessible introduction to much of the CS theory landscape.
Someone already praised the shorter book titled "Algorithms" by Dasgupta et al, and I second it. Tim Roughgarden's "Algorithms Illuminated" series is in this genre too.
I'd also recommend the MIT lecture notes on Mathematics for CS: https://courses.csail.mit.edu/6.042/spring18/mcs.pdf This is distinctive for its intuitive explanations with essential, approachable formalism. The exercises are fine too, if you are really mean it.
Sipser's book on the Theory of Computation is great and the one by Hopcroft et al is also very good (as suggested by others). But the most beginner-friendly (or, light on math) coverage of this area is apparently in Peter Linz's book "Introduction to Formal Languages and Automata". An alternative flavor in the treatment of much of the same topics is in this free book: http://cs.brown.edu/people/jsavage/book/
His contemporaries in Basra, Iraq united Greek (Hellenistic, Hermetic, Neoplatonic, Pythagorean, Ptolmic), Indian, Judeo-Christian scientific, religious, astronomical, cosmological, and philosophical works [2].
Later, Bukhara and Cairo would go on to rival Baghdad until the demise of Islamic Golden Age at the hands of Hulagu Khan.
[0] https://en.wikipedia.org/wiki/Muhammad_ibn_Musa_al-Khwarizmi
[1] https://en.wikipedia.org/wiki/Kufic
[2] https://en.wikipedia.org/wiki/Encyclopedia_of_the_Brethren_o...
http://algorithmics.lsi.upc.edu/docs/Dasgupta-Papadimitriou-...
Broadly speaking there are two types of "CS Theory":
1. "What is computation and what can be computed?" That's what Wigderson's book is about. Complexity theory.
2. "What's the best way to compute something?" covered by "Introduction to Algorithms" and the like -- sth people ask on interview questions. In addition to the references here, http://people.cs.uchicago.edu/~laci/17discrete/ gives some good puzzles to work through.
It's a really good classic little textbook.
0. Do not touch "Introduction to Algorithms" until you are in a dream job.
1. CS 61A: The Structure and Interpretation of Computer Programs https://cs61a.org/
2. CS61B: Data Structures http://datastructur.es/sp16/
3. Coursera: Princeton Algorithm https://coursera.org/learn/algorithms-part1
4. CMU 15213 CSAPP https://courses.cs.washington.edu/courses/cse351/16sp/videos...
5. Keep moving.
Any idea why? Its unlikely I'll ever land my "dream job" butnim curious as to the reasoning.
When I propose to use it to prevent sea rise by drying the sea I only half jest. It's IMO one of the worst books to use except as reference when you already have a good grounding.
https://www.amazon.com/Algorithm-Design-Manual-Steven-Skiena...
Far more readable than the usual text (Cormen), the first half is a guide on how to select and design algorithms for the problems you encounter, and the second half is a whistle-stop tour of hundreds of well-known algorithms. The tour helped me a lot with X->Y esque issues where I was building bad solutions because I didn't know anything better could exist.
Incidentally, there's a lot more to CS theory than algorithms and data structures, but if you're asking on HN for a generic CS theory book, I reckon it's most likely an algorithms and data structures book that you're after.
"Introduction to Algorithms" by CLRS seems to be the default choice, and it seems to me to be a step in the right direction (based on the TOC).
I would also like to second your point that CS is more than algorithms and data structures. I feel Dijkstra would not approve of thinking about CS as "that thing you do after learning a programming language".
Personally I'd use Cormen as "dictionary" to get into detail of stuff I first read in A.D.M.
1. https://www.amazon.com/Computational-Complexity-Approach-San...
2. https://www.amazon.com/Quantum-Computing-since-Democritus-Aa...
3. https://www.amazon.com/G%C3%B6del-Escher-Bach-Eternal-Golden...
4. https://www.amazon.com/Introduction-Theory-Computation-Micha...
"Programming from the Ground Up" starts at the bottom with CPU architecture and goes up from there to how functions work, dealing with files, code libraries, high-level languages, etc. Having a solid understanding here will provide immediate benefits in coding and serve as a strong foundation for some of the other recommended texts.
If you're interested, I recommend buying directly from Bartlett Publishing [1]. Bartlett published the book under the GNU Free Documentation License and there are multiple copy-cat versions on Amazon.
[1] http://www.bartlettpublishing.com/site/catalog/programming-f...
O'Halloran/Bryant CSPP https://csapp.cs.cmu.edu/
David Money Harris Digital Design... https://booksite.elsevier.com/9780128000564/
The first one was new to me. Looks quite good.
Computer science is much broader than that; it includes databases, AI (not the same as algorithms!), computer architecture, topics such as hardware interfacing, history of computing, and some overlap with areas in philosophy.
I didn't ever formally study CS, but I did read several books on algorithms. Especially notable is the seven-volume work "The Art of Computer Programming" by Donald Knuth; in particular the volumes "Fundamental Algorithms", "Sorting and Searching", and "Seminumerical Algorithms" are timeless masterpieces, entertaining and witty, and they totally nail their subject-matter. If you think CS is equivalent to "algorithms", then read these books.
N.B. I understand that some of these books have been re-written to use a revised version of Knuth's MIX machine language, to allow the examples to embody modern developments such as pipelines, caches, and parallelism. I haven't read these updated editions; no doubt they are even better than the originals.
But I think CS is a much broader field than algorithms.
[edit] Harrumph. Wikipedia says that only three-and-a-bit volumes have yet been published. Seven volumes was the original plan. Smacks a little of George R. R. Martin?
My favourite poke at this is Charlie Stross' book the Atrocity Archives (a kind of Lovecraftian, CS nerd horror / humour novel where advanced mathematics is dangerous), wherein Knuth did in fact finish the 4th edition, but it contained secrets that immediately got it shut down by various governments.
There’s a plan in place to do so, but as of now, the current editions of the first three books are still written using MIX (the 60’s-style assembler language that he invented for the original editions). The later volumes do use the more modern MMIX.
Is this some sort of a joke? Do not troll here.
Avoid books with a programming language in the title, because those will try to teach both basic programming and the interesting material.
- The Computational Beauty Of Nature, by William Gary Flake
- The Impostor’s Handbook, by Rob Conery
- The Elements Of Computing Systems, by Noam Nisan & Shimon Schocken
https://smile.amazon.com/Algorithm-Design-Manual-Steven-Skie...
For computer architecture, Petzold's "Code" is wonderful.
Also be sure to check out
- Software Fundamentals, essays by David Parnas
Here's one of the essays from the book: https://www.win.tue.nl/~wstomv/edu/2ip30/references/criteria...
Parnas promoted the idea of encapsulation before the word had even been invented. And at the time, the idea was actually controversial, if you can believe it.
Unless your friend is a natural born comp. scientist, she'll need someone to point out what's important, what's not, which exercises she must solve before moving on and which topics she can take in parallel if she needs a break.
Of course, a course takes time. But if someone doesn't find the time to take an online course, where will they find the time to (properly) read the book?
Another is Subrata Dasgupta's _Computer Science: A Very Short Introduction_, a 2016 addition to Oxford's Very Short Introduction series. It has over five pages of further references to more detailed and specialized works.
Tell your friend to download the lectures locally before they disappear. It will cover estimating complexity, solving recurrences, memoization, dynamic programming, etc. All the assignments can be done in a browser as they're in Pyret.
Ripping the vids cannot be emphasized enough, these lectures always disappear after a few months.
Another way to thing theory of programming logic is a general understanding of language logic for which I recommend https://www.amazon.com/Philosophy-Language-P-Martinich/dp/01...
I am going through that book myself right now. It came to me highly recommended. I don’t have a computer science degree.
https://www.goodreads.com/book/show/52084.Programming_Pearls
Does she want theory? Does she want Software Engineering skills? Does she want to be able to get a job?
Cracking the Code Interview might be a fine jumping off point. It covers a lot of topics at a very readable level. If she doesn't understand it from the books angle, then she can do research on her own until she gets there. It covers stuff like "complexity analysis" in-depth enough for most people.
Then there is also excellent BaseCS Podcast [2]
[1] https://bigmachine.io/products/the-imposters-handbook [2] https://www.codenewbie.org/basecs
https://github.com/imposters-handbook/feedback/issues/50
The book itself is a good idea and the author seems to have good intentions even if they didn't take advice in this case, though.
It is approachable, fun, and engaging. It frames concepts inside a 'detective' story, making the explanations less abstract and more practical.
Pair the above with Petzold's "Code" and you get a very good idea of both the Theory and the Machine.
For actual code, you do not have one book but have to glean the knowledge from a whole bunch of them.
For that, I'd recommend The Pragmatic Programmer, A.Hunt, D.Thomas.
Going way back in computing, often an important issue was, how fast will a program run? That study is now sometimes called computational time complexity.
This study was important because, for some common work, some ways of programming the work ran many times faster than some other ways -- i.e., the study of computational time complexity got some big results.
Usually in practice an issue of a little less concern than running time was how much of the computer main memory would a program need, and this study was computational space complexity.
The first big case of big gains was running time for sorting. So, for some positive integer n, we are given n numbers (or alphabetic names, etc.) and want to sort them into ascending order. So, an obvious first approach is to look at all n numbers one at a time and find the smallest. Then look at the remaining n - 1 numbers and again find the smallest. Then with a little algebra, the running time grows proportional to n^2 (n times n, n squared). So we say (I'm omitting some fine points) that the running time is "big O n^2" written
O(n^2).
Now for some big stuff: (1) There is a way (method, technique, algorithm) called heap sort with running time (computational time complexity)
O(n log(n) )
both on average for random numbers and also for the worst case of the order of the given n numbers. (2) Heap sort works by comparing numbers two at a time (so did our
O(n^2)
algorithm above), and there is a cute counting result from A. Gleason, long a math prof at Harvard, that shows that for sorting by comparing numbers two at a time
O(n log(n) )
is the fastest possible. (3) Heap sort is also in-place which means that the storage used, except for a constant independent of n, is just what is needed for the n numbers being sorted.
After sorting, there was interest in working with trees. Likely the tree most people are most familiar with is the hierarchical file system. A tree can be good for keeping a set of numbers in order while adding numbers to the set or removing numbers from the set. To get good guaranteed fast running time, we want the tree balanced, that is, all the paths in the tree from the root to the leaves are about the same length. So, keeping the tree balanced while making the changes and doing so with relatively fast worst case running time was a challenge. One solution was AVL trees (see D. Knuth's The Art of Computer Programming: Sorting and Searching or more recent books listed in this thread) and, mostly for data stored on disk, B-trees. Actually there are several important, that is, relatively fast, algorithms for manipulating trees.
Early on in computing there were more problems with algorithms that improved running time, e.g., string searching.
There is a general technique, dynamic programming, that is the basis of several important, relatively fast algorithms. Here the programming is in the sense of the English project planning, that is, from the field of optimization in operations research.
Generally, given a program, it can be difficult to do algebraic manipulations, say, assuming either random or worst case inputs, to find the "Big O" running time. Knuth's book starts with a lot of algebraic techniques that can help finding Big O running times. That work can be as challenging as we please.
There is some work that early on was not really in computer science but very much needs computers and where running time was and is a huge issue. An important source of such work was optimization in operations research. The first work of concern was the simplex algorithm of linear programming. Next was the closely related integer linear programming, i.e., combinatorial optimization. There were too many cases of problems starting with n numbers and running in
O(2^n)
which is exponential and so bad that, for too many realistic problems, we could run for billions of years with about the fastest computers we can imagine and big enough to fill the visible universe, literally.
So, a question became, can we have some positive integer k and have worst case running time grow only as
O(n^k)
that is, a polynomial in k? The problem was generalized and now is the question of P versus NP, the leading question in computational complexity and maybe in much of computer science and pure and applied mathematics. The standard example of such a problem is the traveling salesman problem were we are given some n cities and ask for the shortest path that visits each city exactly once.
That's a nutshell start on computational time complexity in computer science.
"there is a cute counting result from A. Gleason, long a math prof at Harvard, that shows that for sorting by comparing numbers two at a time
O(n log(n) )
is the fastest possible."
by adding at the end "for worst case performance".
Should revise
"Then look at the remaining n - 1 numbers and again find the smallest."
by adding at the end "etc.".
Generally computer science computational complexity ignores long lists of ways to write code that runs faster, e.g., for a result needed more than once, compute it just once and store the result and don't repeat the calculation.
Instead, the emphasis is on some larger aspects, e.g., just counting comparisons. Broadly that emphasis is usually appropriate since as n grows quite soon some crude code of a O( n log(n) ) algorithm will run many times faster than careful code of an O( n^2 ) algorithm.
All of the code you write is run by one or more CPUs; operating systems provide supporting software, they don't "run" programs (although they may schedule them for execution, which isn't the same).
</pedant-mode>