Algorithms [pdf]
cs.berkeley.edu
cs.berkeley.edu
I had a visceral reaction against CLRS when I saw the standard pseudo-code the book uses. But as I tried implementing some algorithms in C, I found that the algorithms were so precise and detailed that there was no better way to represent it (apart from giving the C code directly).
I've heard claims that CLRS' pseudo-code could be presented in a higher level manner - but it defeats the purpose of an Algorithms text. Algorithms should be correct, fast and consume the least memory possible - this requires you to think about low level memory management, cost of comparisons etc.
However, the density and detail of CLRS forced me to look for other books which presents the topic in a better manner. Vazirani is an excellent choice in this regard. The language is clear and easy to understand, and it gives a better high-level picture than CLRS. I remember reading Chain Matrix Multiplication (page 184, 6.5) in Vazirani and being overwhelmed by the simplicity of the presentation compared to the dry formalisms used in CLRS.
From my experience, I recommend using CLRS as an aid for rigorous study and Vazirani for less rigorous, but very effective learning. Also take a look at Sedgewick's Algorithms in Java series - http://www.cs.princeton.edu/~rs/ (he has C and C++ series, but Java is what I've used). It is more detailed than Vazirani but at the same time more approachable than CLRS.
I had used CLRS many times to explain algorithms to non-CS students and collaborators ( who almost always preferred dynamically typed scripting languages like python and to be honest were scared of ints and floats ). At the same-time some of them were very good in algorithm design, and came up with clever (algorithmic) ways to solve the problem at hand much more efficiently.
But your argument does hold true when one is dealing with things like sorting or graph traversal algorithms. There the concepts are most important and you can do well without worrying about the low level details.
The slight downside is that sometimes the given algorithms are not quite as worked out in detail as in some other textbooks. Yet it's probably the algorithms book that has taught me the most.
When designing an algorithm, you ought to make sure that it actually works. At some point, then, you're going to have to prove it. Which for most people is hard, in part because most algorithms books present the proofs as a fait accompli. They just show up, fully formed.
But Manber argues, and demonstrates convincingly in his book, that the design and the proof both become easier if you do them together. The design guides the proof, the proof the design.
He's right. Since reading the book, I don't do it any other way.
The book, tragically, costs about $110. But if you care about this stuff, it's worth it.
I learned algorithms from CLRS (as most students have), and it is bar-none, the best data structures/algorithms book on the market. The explanations are clear, detailed and rigorous.
The Vazirani/Dasgupta book does not go into as much detail. You don't believe me that this book is bad? Read some of the Amazon reviews: http://www.amazon.com/Algorithms-Sanjoy-Dasgupta/product-rev...
I'm not denying that I enjoyed learning from CLRS - but I recollect having to take more effort to parse its detailed pseudo-code than what a higher level of abstraction would've taken.
This is where a book with less detail like Vazirani can help. I would never recommend relying on a single text for studying anything - least of all Algorithms. Each of these complement the others in a nice way and being able to look at the same concept from the perspective of different authors always help.
> The Vazirani/Dasgupta book does not go into as much detail. You don't believe me that this book is bad? Read some of the Amazon reviews: http://www.amazon.com/Algorithms-Sanjoy-Dasgupta/product-rev....
You've pointed to the 3 one-star reviews instead of the 17 five-star reviews of the book. Was that a mistake? Joking aside, those reviews seem to be from people who've tried to use Vazirani as their sole Algorithms text. Having seen CLRS first, I've always approached Vazirani as a complement to CLRS and that worked.
The fact that it's freely available online doesn't make it worth reading. If someone is actually recommending it, I'd like to know why they prefer this over, say "The Algorithm Design Manual". Just posting a link tells me nothing. I hope the people that say they're going to try reading this can give a detailed review in a few weeks' time - or even a few hours' - I'd be much more content diving into a chapter of this if I knew someone else thought it worthwhile.
Edit: I see jasim has read it :)
If algorithms are interesting to you, I certainly wouldn't turn you away from it.
That said, if I were teaching algorithms in a classroom setting I'd probably still use this book and supplement it with lectures where it falls short on deep details.
If you're looking for a book to pick up on your own it all depends on your math background. You might find yourself using Google frequently to clarify things, or you might be just fine.
Dead tree link for those interested: http://www.amazon.com/Algorithms-Sanjoy-Dasgupta/dp/00735234...
* It emphasizes rigor without much formalism.
* Rich number of non-trivial exercises.
* Conciseness of description of algorithms and strategies.
If you look for a textbook with algorithms translatable to C/C++/Java codes line by line, this is not one of them.
1. Programming Pearls by Jon Benley. 2. Programming Challenges by Steven Skiena. 3. Algorithmic puzzles by Levitin.
The first two are mostly programming focus. I have not read the 3rd book, but I have a good idea what it is about (based on other books by Levitin); it should be good.
[1] https://www.coursera.org/course/algs4partII [2] https://www.coursera.org/course/algo2
I believe all of these videos are also available on his YouTube channel by the way.
Or am I incorrect in thinking the two are discrete concepts unable to be separated?
Manipulation of the linked list often requires a traversal. Also, inserting data between nodes also require a little juggling of the node pointers. These are all what you can call 'algorithms'. Data structures can exist and be learnt somewhat independently of their underlying algorithms, but it is rarely useful like that.
There are however pure algorithms that do not care much about the underlying data structure - insertion sort is an example. Most data structures though aren't very much useful when separated from their fundamental algorithms.
Hope that answers your question.
I found Sedgewick's Algorithms to have quite good coverage of data structures, however.
Can't find either my copy or online references.
Also, why scribd? (API I'm guessing?)
Scribd went through Y combinator.
By which I mean, it just appends the posted URL as a scribd url parameter, it doesn't actually "scribe" it...
When I click on the link, it redirects me to http://www.scribd.com/doc/969071/All#full. At a glance, view-source appears to grab each page from http://scribdassets.com. I think Scribd is clearly serving the material from their own site. Is there a different mode for cases where they have permission from the copyright owner?
If you are considering coding competitions like TopCoder, you should look at Skiena's Algorithm Design Manual. It covers a lot of ground that is not covered by CLRS or the like.
But I think between Skiena, Sedgewick, CLRS, Vazirani and TAOCP, you have fundamental algorithms and data structures covered. If you are looking to go into detail on specialized topics like say AI, these texts wont help much.
If you've read a book or two on the basics, your best bet is to look for books on a specific topics, like computational geometry, evolutionary algorithms, or parallel algorithms.
http://www.flipkart.com/algorithms-0070636613/p/itmczynvb7p2...
What I really could need though is a reference book for parallel algorithms. Especially shared memory PRAM algorithms for OpenCL, OpenMP & co. Most current books only assign a chapter at most to this. I guess the main problem here is that parallel algorithms are still very much in their infancy compared to their sequential counterparts.
That gap is closing slowly as a lot of old algorithms are being remixed into highly parallel versions. This is noticeable in string pattern matching applications, driven by the need to analyze tons of DNA.
More people would benefit from knowing how exactly to code efficiently on the GPU before jumping right in to writing algorithms on it; it's easy to lose multiples of throughput if you don't know what you're doing. As always it's becoming easier for programmers though; if you're new to the idea of GPU programming I really recommend checking out Microsoft's C++ AMP[3], which shipped with VS 2012. Removes a lot of the headaches of programming with CUDA and OpenCL. I've had a chance to play around with it, and it's excellent.
[2] http://books.google.ca/books/about/Computational_Electrodyna...
Amazon Link (no affiliate): http://www.amazon.com/gp/aw/d/0073523402/ref=mp_s_a_2?pi=SL7...
And here's the uk one: http://www.amazon.co.uk/Algorithms-Sanjoy-Dasgupta/dp/007352...
So the question to those who have already read this is: Is there a blog or a site or something of that sort that has covered this book and posted code samples or something like that.
I'll definitely give this chapter a read. Thanks for posting it.
The first part goes here to the PDF directly: http://www.cs.berkeley.edu/~vazirani/algorithms/all.pdf
The second part, "[scribd]", goes to scribd.
This one should be chewed and digested. It's not a race - work slowly and diligently, and start exploring the boundaries of the topics covered, and you'll get much more out of it.
Depends on the book and who is reading it. The OP is pursuing PhD and has computing background http://news.ycombinator.com/item?id=4783710
This text is covering selected undergrad topics barring the chapter on quantum algorithms(I am not sure what it is).
> it's always good to review things one has already learned. For me this usually leads to insights I haven't had before and a deeper understanding. Learnings seems to be an iterative process.
This is my primary motivation.
Thanks for the advice. Just in case, I am a Masters in CS and currently into my PhD.
However, it's always good to review things one has already learned. For me this usually leads to insights I haven't had before and a deeper understanding. Learnings seems to be an iterative process.
For example, I wouldn't say I really understood linear algebra until I went back and watched Gilbert Strang's lectures on iTunes U after my MS[0]. Which is, of course, somewhat awkward, as I encountered many problems which required using it during my studies, but the only course I had on it was my freshmen Calc II class.
Basically I'd made it through years of schooling being able to make use of a tool without actually understanding the tool. If you'd asked me to solve any problem that required insight into LA rather than just application of common mechanical primitives, I probably did quite poorly.
[0]: These lectures are fantastic by the way; they served as a good jumping off point for a bunch of other post-education math study for me.
As I said, reviewing material will probably lead to insights you haven't had before. If you've got spare time it's always a good idea to read a book on a topic like algorithms or a math book in order to get a deeper understanding, even if the book is just repeating things you already learned.
If you're just interested in genetic algorithms, those are covered in chapter 3.