top | item 2446790

Simple algorithms

222 points| taylorbuley | 15 years ago |algorithms.openmymind.net | reply

32 comments

order
[+] baddox|15 years ago|reply
I like the writing style and simplicity of presentation. I would recommend putting some thought into the order and organization of the articles. Perhaps you should have "main" articles about data structures, then sub-articles about the algorithms that are relevant to them (e.g. "binary search" could be under "arrays," "heapsort" and "priority queue" operations under "heaps," etc.). Obviously, it's a challenge to choose the order and organization of topics and subtopics—it's essentially the task of developing a curriculum.

If you plan on doing some tree/graph algorithms, perhaps you could have a brief introduction to the topic by talking about trees and graphs in general, then proceeding by discussing heaps, simple binary trees (which can branch off into more advanced topics like the various balanced binary trees), and so forth.

As a side note, I think binary trees are a great visual way to introduce the concept of asymptotic running time in a more accessible/pragmatic (albeit less rigorous) way, by showing that the more balanced a binary tree is, the fewer steps it will take on average to find an element (approaching the best-case of log base 2 of n). You can show how a worst-case unbalanced binary tree degrades to a linked list.

[+] latch|15 years ago|reply
I struggled with the ordering. I wanted to do linear searching first, because i thought it was the most fundamental and important to understand for the other stuff. And then I didn't want to do binary search right away because it's more complex.

I'd like to add more, but as I said in another comment, when I started doing quicksort, it didn't feel right. I'd likely need to build a different UI paradigm to represent more complicated algorithms. Same with a btree, I really want to go over it, but that seemed like a ball of UI hurt. Might still try to tackle it though.

[+] nikolaplejic|15 years ago|reply
I really like the simplicity and the choice of language. I think a comments / discussion section would be useful, for people to ask questions, talk about the ways to make the articles even better and perhaps translate the code to other languages.

All in all - I hope you keep up the good work, solid tutorials like these make it more compelling to keep up with the basics and learn new things from the "CS 101" department.

[+] latch|15 years ago|reply
I can't believe I didn't think about comments. I've enabled disqus! Thanks for that, and the other, ideas.
[+] jcampbell1|15 years ago|reply
A fantastic set of articles. I do think that tutorials in general obsess over sorting too much. Rather than expanding this with dozens of sorting algos, it would be nice to see a treatment of trees and graphs. Lay the foundation for someone to understand search trees, huffman coding, A*, etc.
[+] tszming|15 years ago|reply
[+] baddox|15 years ago|reply
Does the author ever claim what language the code is in? Sure, it looks like JavaScript, but he could easily have just borrowed JavaScript's function syntax (which is easily readable to anyone who's used virtually any imperative programming language) for his pseudocode.

The potential "bug" you pointed out has nothing to do with the algorithm being taught, and is an implementation detail that's irrelevant for this application.

[+] jws|15 years ago|reply
Yes, but if you are using binary search on a list with 2^52 elements…
[+] Apocryphon|15 years ago|reply
I've seen many of these "intro to algo" presentations and I have to say this is one of the best. I suppose the Web 2.0 minimalist style helps to facilitate understanding very well. Perhaps there could be sites that could provide math tutorials in the same way.
[+] mfonda|15 years ago|reply
I really like this idea, thanks for putting this up. I think it would be nice to additionally split it up into a data structures section and an algorithms section.
[+] damncabbage|15 years ago|reply
This site is great! I love the way latch has presented the examples with each concept. (I would've begged for something like this ten years ago when I was still in highschool.)

I would love if he could take this further and, say, cover graph algorithms in the same way the Linked List was done here.

[+] tcarnell|15 years ago|reply
Nice! Great idea for a site - actually, I kinda had a similar idea when I registered "algolution.com" - the idea being to have a library of algorithms AND people can add implementations in different languages and of course vote up which are the best.

In addiation I had thought to add a 'live run' feature so that you could actually run 1 or more algorithms together and compare performance/memory usage etc!

hmmm... if we defined an API for running a piece of code and returning results, we could build a series of independant web applications that could run sandboxed code in different languages live on the web...

[+] nickconfer|15 years ago|reply
I had this same idea the other day. Glad to see someone made this. I hope you add more content in the future.

From a teaching perspective I think it would be great to see the math behind this as well to get the worst case scenerio.

[+] thurn|15 years ago|reply
Is this open source? Nice visuals.
[+] latch|15 years ago|reply
I'll probably post the source on github sometime over the weekend.
[+] Rickasaurus|15 years ago|reply
Oh look, it's 200 level CS algorithms.
[+] pavel_lishin|15 years ago|reply
Oh no, not a free resource with controllable animations that show you step by step what's happening in the code!