views:

308

answers:

4

What's the best way to "see what is happening" in an algorithm/data structure? If it's something like a binary search I just imagine a bunch of boxes in a row, and throwing half of them out each time. Is there something more powerful that will let us grok something as abstract as an algorithm/data structure?

Clarification: I'm looking for something a little more general. Example: in order to visualize time - some people use a clock in there head but thats slow, whereas a more natural feel would be a globe and if you are trying to get a 'feel' for how an algorithm works you can imagine two objects moving in different directions on that globe.

+3  A: 

In general, animations are excellent for visualizing processes that occur over time, such as the execution of algorithms.

For example, check out these animations: Animated Sort Algorthms

Here's an animation that shows how the data structures work on MergeSort.

Now, whether you want to spend time hooking up your algorithm to some kind of animated visualization is a different question!

David
Wow - if you start all of the algorithm animations at about the same time, look at Quick Sort go!
David
A: 

Describing something in terms of another thing is called analogy. You just did it with the binary search being a bunch of boxes. Just play with the student's prior knowledge.

For instance, trees can be thought of linked-lists, with multiple "next" nodes, or they could be explained to the uninitiated as something similar to a hierarchy.

As for concrete methods of explanation, graphs and state machines can be easily visualized with Graphviz. A very basic, directed graph can be expressed very simply:

digraph G {
   A->B;
   B->C;
   C->D;
   D->B;
}
Ryan Fox
+1  A: 

Algorithm animation was a big research area in the 1990s. Marc H. Brown, who was then at the Digital Systems Research Center, did a large amount of interesting work. The source code to his Zeus animation system is still available, and it would not be hard to get it set up. I played with Zeus years ago and if I remember correctly it ships with dozens of animations.

They had a couple of 'festivals' where non-experts got together to animate new algorithms. You can see one of the reports (with still images) on the 1993 festival. YouTube has one of their videos Visualizing Combinatorial Structures.

Norman Ramsey
A: 

more clarification: I'm not talking about using some animations to display dots on the screen like some of those neat apps mentioned above do, but more of a way to view these things in my mind's eye.

eviljack
Can you elaborate? Seems to me that the dots on the screen are someone's attempt at externalizing their mind's eye.
ja