Hacker News new | past | comments | ask | show | jobs | submit login
Algorithm Basics?
17 points by raju on Oct 2, 2007 | hide | past | favorite | 34 comments
To all hackers out there. I am a self taught programmer who wants to start with the very basics of algorithms and data structures. I took a look at "Introduction to Algorithms" but it came across as more academic than practical. Any suggestions?



"start with the very basics of algorithms and data structures" ,"more academic than practical", "something to get my hands dirty with vs mathematical theories" etc seems to me to indicate that you want to write code rather than work with proofs, runtime analysis etc.

Take it from someone who tried this path and failed. In algorithms, the long path is the shortest path.

If I were advising someone on how to go about learning algorithms today, I would ask him to first learn the basics of proofs ("The Hsskell Road to Logic Maths and Programming" by Doets and Van ejck is a good book as is Velleman's "How To Prove It"), then work through (at least) the first three chapters of Knuth et al's "Concrete Mathematics" - to get a handle on recurrences - and then tackle "Introduction to Algorithms" , probably supplemented by Skiena's "Algorithm Design Manual".

Avoiding the "academic" parts is (imho) a big mistake. As with compilers, the core of algorithms is "academic" and you can't avoid that (imho).

And once you get your head around proofs etc you may find this aspect a lot of fun. I certainly did.

my 2 cents. fwiw.


I have an engineering degree, both undergrad and masters, so I am well versed with proofs. After all the suggestions fellow hackers have put in (including you), I am convinced to pick up "Introduction to Algorithms" and take it from there.

Thank you (all of you). Though I think this was the answer I was looking for.


"Introduction to Algorithms" by Cormen, et al came across as not practical? That book is personally my favorite. What are your criteria when judging a book as practical?

As someone else mentioned, you might like Sedgewick's books, but it's hard to tell without knowing what your criteria are.


Hey jey, I came across that book at the local bookstore, and perused it for a while. What I meant by practical was a book that gave me something to get my hands dirty with vs mathematical theories, thats all. Maybe that was a little shortsighted, and considering a lot of the other comments suggest the very same book, I will take a look at it again. Thanks!


Algorithms are mathematical theories. You're not going to be able to learn them through code alone.

There are certainly less dense introductions to the subject, but Cormen is the classic that you'll see on every good programmer's shelf (and they even read it, too!)

Edit -- "Data Structures and Algorithm Analysis" by Mark Allen Weiss is an example of a common, less-dense introductory text. It's actually not bad, given its intent.


What other books does every serious programmer need?


Are you being snarky or sincere? It's a good question, if it's an honest one.


No please. I am a slowly reforming chemical engineering student.


I have a grad degree in algorithms and the best book on algorithms is Cormen et all's "Introduction to Algorithms". You will be able to keep this book around forever and you won't outgrow it that easily. Definitely the best book on algos and an excellent reference.

http://projects.csail.mit.edu/clrs/

Google Books: http://books.google.com/books?id=NLngYyWFl_YC&dq=&pg...



From the site it looks like the book is yet to be published, but its available in print...http://tinyurl.com/2kg6to

Though having the draft is quite nice...Thank you


Though having the draft is quite nice

Yes, it certainly gives you get a sense of their approach to the subject (as one of Amazon reviewers said it's not a substitute for CLRS, but a good supplement).



Sedgewick is good. I learned a lot from this book, which is tailored for C++ http://www.amazon.com/Algorithms-C%2B%2B-Parts-1-4-Fundament...


I'm the process of reading the Algorithms book and converting some of the functions to Scheme :D


I agree with CLRS.

It might be good to look into the mathematical side of the algorithms though, so that you know how they work inside. This way, you can manipulate the algorithms and fine tune it to something you want later on.


MIT's Intro to Algorithms class lectures are a available in video: http://ocw.mit.edu/OcwWeb/Electrical-Engineering-and-Compute...


Find a problem you want to solve, ideally in a public project with good senior maintainers... you'll learn everything you need by doing.


orph recommended being an apprentice, which is a good approach


I have to agree that CLRS is probably the most thorough, but as a bare introductory book to someone learning on their own (who probably is not currently in a computer science program) I would recommend Introduction to the Design and Analysis of Algorithms by Anany Levitin. Good luck!



Go to the source "Art of Computer Programming" Get your hands dirty with MIX


I hope the parent comment is intended to be sarcastic.

If you're not familiar with The Art of Computer Programming ("TAOCP"), it is an unreadable dense and heavily theoretical treatment of much of the fundamental data structures and algorithms in CS. It's definitely a classic, but I wouldn't try to learn from it if I wanted to be 'practical'. TAOCP is much worse than Intro to Algorithms in readability and practicality.

The most practical use for TAOCP is to display it prominently on your bookshelf to impress your colleagues. :P


A friend of mine is buying the full set of Knuth's books because some algorithms are only discussed here. So if you're a completist, these are for you.


I have yet to find a use for a tape sorting algorithm. ;-)

Yes, TAOCP is comprehensive and thorough. It's a useful resource, but pedantic and difficult.


+1 for CLRS. You may run into CLR, but that's an older edition



Thanks amichail. I will look into it. It does look interesting.


How about the Wizard book? It's not so much centered on algorithms - but about how to organize your programs.

Or is it to hard for a beginner?


Anyone else annoyed at these "I'm not a programmer, no that's too hard, make me a programmer the easy way" posts?


I'm not sure the O.P. fits that profile.

Also, none of the books recommended here fall into the "Learn Blub in 21 Days" category.


Yeah you're probably right, I'm just irritable.


I think I see where you are coming from. But this is not my way of finding out an easy way to become a programmer, rather a better one. In my defense, I am trying to work around the fact that I don't have a CS background, and am trying to learn as much as I can. I certainly know that there is no shortcut to the "promised land".


You might need something one step below CLRS. Try a good CS2 book.

The only algorithms I use regularly at a boring blub coding job is quicksort and binary search. The only data structures I use are hashes, arrays, and binary trees. Other niche data structures like tries, Bloom filters, etc. are useful sometimes but 90% of the time it's a very small handful of techniques you're using.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: