The visualizer is really nice, the examples could use some work though.<p>Selection Sort, for example, makes the algorithm look extremely (impossibly) good at first glance - O(n) - because it's not showing the majority of the steps.<p>Instead of<p><pre><code> for (var j = i + 1; j < D.length; j++) {
if (D[j] < D[minJ]) {
tracer._select(j);
minJ = j;
tracer._deselect(j);
}
}
</code></pre>
it has to be<p><pre><code> for (var j = i + 1; j < D.length; j++) {
tracer._select(j);
if (D[j] < D[minJ]) {
minJ = j;
}
tracer._deselect(j);
}
</code></pre>
Bubble Sort has the same problem, as do Quicksort and Mergesort.<p>Normally I wouldn't mind, but these examples are intended for beginners, and it might give them a false sense of time complexity for these basic algorithms.