views:

2542

answers:

20

I'm interested in learning about algorithms, both conceptually and practically, as a beginner. I want to learn about binary search trees and similar.

What tutorials and example programs, preferably in Python or Java, will help me?

+11  A: 

A good algorithm is probably language-agnostic. These are really theoretical subjects so there should be enough books and articles about them. Now if you really want to know about algorithms, I suggest you take a college course about them (or watch some of the videos of the lessons online)

You can always learn about specific algorithms via the biggest source of information in the world, wikipedia http://en.wikipedia.org/wiki/List_of_algorithms ;-)

Javache
Wow - that Wiki article is awesome, thanks!
Devoted
I just have to say (with a tongue in cheek) that Wikipedia isn't "biggest source of information in the world", but instead it's "largest collection of near-accurate articles in the world". Difference is that latter can't be used as a reference to anything academic/scientific.
Esko
Wikipedia is a one-stop meta-reference. Wikipedians are quite keen on citing references (or urging other Wikipedians to do so). So search Wikipeda for answers, go to cited reference to confirm it.
slim
A: 

Can you be more clear? You can learn about algorithms without reference to a programming language. The good thing about Python and Java is that lots of the algorithms are already written for you.

RobinReborn
That certainly has its downsides as well. Spending time implementing standard algorithms seems to be to be very worthwhile, for the training it gives you on multiple levels: Both in being able to come up with algorithms of your own and deeply understanding what the standard ones do.
harms
+8  A: 

Ugh, telling people to just take a college course is a bit flippant. Anyway, like the others said, data structures and algorithms are not dependent on a language per se. Anyway, if you don't mind watching video, there is a good Berkeley Webcast course (so nearly every day of the course is viewable) which is pretty good:

http://webcast.berkeley.edu/course_details.php?seriesid=1906978271

BobbyShaftoe
"Ugh, telling people to just take a college course is a bit flippant":) That's true, but I guess it told me how extensive a topic like algorithms is (although I knew).thanks for the link.
Devoted
+35  A: 

MIT has a course on algorithms in their Open Courseware Program with video, audio and PDF lectures.

There is also an online course, also with video lectures, at ArsDigita University.

At University of Florida there is the course Data Structures and Algorithms in Java, and just as the above it has video lectures available online.

At freescienceonline.blogspot.com you can find a whole lot of video lectures on algorithms, as well as a lot of other interesting videos.

Erik Öjebo
Yea, I finally followed the link to the MIT course site I have heard about. Looks interesting. Thanks!
TURBOxSPOOL
+3  A: 

If you really want to start from scratch, I'd suggest one or both of:

MIT's OCW algorithms course, which has video lectures.

Introduction to Algorithms, which, if read carefully from the start for the first 15 chapters or so, gives a really excellent introduction to algorithms. The book is language agnostic - the algorithms are written in pseudo-code. However, I think this is a benefit; you can't just copy or paste solutions, you have to think about translating them (which is typically trivial) into Python or Java which will help your understanding. Eventually, you'll build up a library of go-to code.

There's an awful lot to learn about algorithms and data structures. You need to be reasonably confident with some discrete mathematics to be able to understand all the theory, but you might find it's easiest to lazily evaluate your need - when you come across something you don't understand, look it up and spend some time getting it.

HenryR
+4  A: 

Binary search trees will usually be covered under the topic heading "Data Structures". In a Computer Science curriculum this normally comes before an Algorithms course, but the two are intertwined. Most data structures have specific algorithms that are defined for them and many algorithms only make sense for a certain set of data structures.

Algorithms can be explained using a lot of languages. I think Python actually makes a pretty good pseudo-code. It has the added benefit of being executable.

Here is an online book on data structures and algorithms using python: Data Structures and Algorithms with Object-Oriented Design Patterns in Python

Here is a book I recently picked up that uses Python to describe computer science concepts, including an introduction to algorithms: Python Programming: An Introduction to Computer Science

John Mulder
+3  A: 

Start with an accessible book like: Algorithms In A Nutshell (Heineman, Pollice, & Selkow) which has examples written in C, C++, Java, and Ruby, then if if you want more theory go for the college courses and dense theoretical tomes.

EDIT: online you can check out Data Structures and Algorithms with Object-Oriented Design Patterns in C# by Bruno R. Preiss B.A.Sc., M.A.Sc., Ph.D., P.Eng. for C# code to walk you through the algorithms. Worth checking it out.

kloucks
A: 

You may also use The Stony Brook Algorithm Repository. It does give an overview about algorithms for many kinds of problems. The Java implementations part gives you a list of Java libraries implementing various algorithms. The related book, The Algorithm Design Manual, gives you a "war story" based approach to algorithms.

Yuval F
A: 

first learn python/java then use the CLRS book.

xxxxxxx
A: 

Just before you start, wherever you decide to, I'd just point out that one important thing you have to grasp out of the topic of algorithms is the Big O notation. That's your equivalent of horsepower when two car addicts discuss the performance of their engines, and your starting point when you need help around an algorithm you have to develop.

And take it by heart, most of the algorithms are useless since you'll hardly find any practical application - some algorithms are there just to serve their own purpose.

If you intend to hop over to your bookstore, make sure you doubly check the reviews on Amazon. Some books just go through lengths and lengths to give you some overkill scientific explanation, but lack on practicality, diversity of examples and coverage in popular programming languages. Other books will give you a bunch of made algorithms that are only good for a single problem and usually follow some bogus pseudo code that lacks good explanation Then, there are books that actually teach you how to fish. I suggest you take the time and find those book for your language of preference.

kRON
A: 

I am sure that the suggestions that have been given so far are wonderful, but I must admit that having been out of the college world for many years I tend to rely on literature for learning. Obviously the most thorough author on algorithms has to be Donald Knuth, who has a series on various algorithms. Over the years I have gone back to one of the volumes for reference, but some of the discussions are rather beyond . The other books I have used are: Algorithms by Sedgewick, or Fundamentals of Computer Algorithms by Horowitz and Sahni.

apolinsky
+2  A: 

The book that I am sitting with right now is Algorithms in C++ by Robert Sedgewick at Princeton U. It seems to have everything you could want in a start out text and makes a good reference. Which is why it is sitting here now.

Carl McDade
I find it to lack allot of theoretical foundations.Try to go through Red-Black trees from it and please tell me your oppinion on how it explains those.
xxxxxxx
+5  A: 

I have become quite the fan of Project Euler lately. There are something like 220 problems that get progressively more challenging as you go.

I feel confident that Project Euler has helped me teach myself some new aspects of Java, as well as keep me fresh on some of the stuff I learned years ago.

eleven81
A: 

In addition to Introduction to Algorithms (good introduction), and Sedgewick's book (more detail how to implement in particular languages) mentioned elsewhere on this thread, I like The computational beauty of nature which introduces recursive, fractal and emergent algorithms as a complement to the more data processing orientation of the other two.

Pete Kirkham
A: 
  1. Steve Skiena's lectures - Lectures from the Algorithms course that Skiena conducted at Stony Brook in '97 is one of the best. He explains each concept in a very simple elegant manner. Skiena's lectures on Discrete math is available as well.

  2. ADU - http://www.aduni.org/courses/algorithms/ Algorithms lecture at ADU is good but the discrete Math course is better

  3. UC Berkley has lectures on Data Structures and algorithms on iTunes

+2  A: 

My personal experience is that learning (and watching videos) will only give you a high level overview. Only when you actually sit down and implement it you'll learn. So I would say key to learning algorithm is practice. Try Project Euler, Usaco or Topcoder.

A: 

I am not sure of the kind of resource you are looking for exists but there are some very good university classes on www.youtube.com/edu which will surely help you to revise the concept of data structures and algorithms.

  1. Data structure class by Prof. Jonathan at UC, Berkeley is really good on youtube is very good, link here.
  2. Academic Earth CS Lectures
  3. Berkeley Webcast Links
Rachel
A: 

Try the book Introduction to Algorithms by Cormen et al.

It is a comprehensive, yet simple read which you will definitely find useful.

Crimson
A: 

Since algorithms are in practice tightly coupled with their implementation and good design of the code, I would recommend this book:

Brian W. Kernighan and Rob Pike, The Practice of Programming, Addison-Wesley, Reading MA, 1999. (http://www.powells.com/biblio/4-9780201615869-0)

Reading this book will help to practice as you go discovering the world of algorithms and software design and implementation.

D_K
A: 

You will not learn much without practice. You can start with some problem sets like SPOJ - these are called "online judge" systems - you can easily find more. In the beginning of solving problems career it is not a bad idea to read the sketch of the solution first (you can find some solutions here and there on the web) or to look for problems dediacted to a given topic (there are some sites dedicated for Problems Classification like those described here)

kuszi