Computer Science 15-110, Fall 2009
Class Notes: Animated Processes
In class today, we wrote an animated insertion sort. The general
approach was to do the entire insertion sort first, storing each step (each swap
and compare) in an ArrayList of Steps. Then, we reset the array to its
original (random) state. Finally, each time the timer fired, we performed
the next step in the ArrayList of Steps. The code is not attached here --
reconstructing and/or enhancing the code is assigned for (optional) lab 9.
Note that this technique is hand in general when you want to animate an
algorithm or process and you have a "closed form" (or "black box") of it, but it
is unclear how to translate that into a stepwise version. This is
particularly true for recursive algorithms!
carpe diem - carpe diem - carpe diem - carpe diem - carpe diem - carpe diem - carpe diem - carpe diem - carpe diem