- Starts to feel kind of
slow, as we can see here.
Let me go ahead and open up --
- So almost every year I have to start
searching for new visual demonstrations
to use.
Because for a long time
we use those old school
Java applets, which
barely even run if at all.
- [INAUDIBLE] doesn't
even support them anymore.
- No.
You have to jump through hoops
just to get a Java runtime to work.
So this one's an HTML5
version, which is wonderful.
And while it does show the algorithms
from a different perspective using
these tall bars for big numbers,
small bars for little numbers,
it's nice because I think this
helps cut through the slower
pace of our human demonstrations.
And you can actually see, in this
case, things are bubbling up to the top
much more quickly than our
eight volunteers could do.
And we can have many
more bars this way too.
So you can really see
the aggregate effect.
- Yeah.
Because sometimes in
those demonstrations
it's actually just people moving slowly.
But here we have this sort of consistent
time where one iteration is happening
and you can see that at the beginning
bubble sort takes a long time
to move a single
element, but as we begin
to add more elements
to the sorted portion
at the end of the array it's
getting smaller and smaller.
So students can see where
things are inefficient
and where things get more efficient.
Although overall, of course, bubble
sort is not the most efficient
of algorithms.
- Yeah.
It's nice because now we
can select another one.
Like selection sort or
insertion sort or even other
algorithms that we ourselves
don't tend to introduce in class,
can be visualized in this way.
But by far, I think, the
most compelling thing to do,
which we typically do after
showing a few of these algorithms
with this approach, is to compare
those things side by side.
And you actually see
selection sort and bubble sort
and merge sort or any analog and
algorithm competing against it.
That's kind of a mind
blown opportunity in class.
- Somebody's got to get out
there though and make it
so that you can start running
all of them at a the same time.
Because you have to manually
click on all the individual ones.
- And they're always off.
And then there's slightly
different data sets,
which is a little misleading that each
of them is sorted a little differently.
But on the whole, thankfully,
it all kind of averages out.
But it is a powerful thing.
- The other thing that's
really cool to do is to show --
there's a series of videos
online where people have
attached the sound to various things.
And if you're not a visual person,
maybe if you're into music or into audio
stuff, maybe that's another --
- Well, and kind of
hearing an algorithm.
Yeah, and getting a sense
for its shape and its sound.
- It's weird that they do kind of have
shockingly different personalities
almost associated with them.
- Yeah.
They do.
And then there's the
Hungarian folk dances
that you can find on YouTube where this
amazing troupe of folks ax them out,
a little dramatically.
I mean, they move around the stage
even more than our humans do.
But almost every year I get
a text message or a message
from some student in the class saying,
hey, you should check this out.
So that's cool that
people engage with it.
And they start to see bubble
sort or whatever all around.
Even in the Barack Obama
clip, when he was being
interviewed by Google's Eric Schmidt.
- Yeah.
- Like that's an amazing clip.
Even though it's in super low
quality SD on the internet,
it's fun to hear someone like
him actually say bubble sort.
Like, oh my god, it's relevant.
- Here's that side by side
that you were talking about.
- A little different.
Rotates thing 90 degrees.
- It rotates things 90 degrees
and it's going to be painful
when we start running on the first two.
- My money's on merge sort.
Who do you got?
- I got merge sort too.
- No, no, no.
- All right, fine.
I'll take selection sort.
- All right.
Come on merge sort.
Come on merge sort.
Yes!
- Do I have to buy lunch now?
