DAVID MALAN: --idea of abstraction, but we started here.
Here now we might represent in a computer
our inputs with zeros and ones--
DOUG LLOYD: So at this point we've discussed inputs
and we've discussed outputs, but we haven't really
looked at what that black boxes is of algorithms.
And we're about to take several hundred Harvard students
and run them through an algorithm to see how they perform.
DAVID MALAN: Yeah, this was, I think, inspired by a former professor of mine
in an algorithms class, I think years ago, where you have everybody stand up
and you then have everyone take on the number one
so that everyone is effectively counting themselves
at that moment in time in unary notation,
and then you have half of the audience sit down
after pairing off briefly with one other member of the audience
so that all of the ones combine to twos, but then half of them sit down.
And then you repeat.
So then you go to four, and then eight, and then 16.
DOUG LLOYD: At least in theory.
DAVID MALAN: Yeah.
I think in 10 years of teaching CS50 I'm not sure we've ever
taken an accurate attendance11
DOUG LLOYD: Well, great--
DAVID MALAN: --because every year then you can say,
the bug, well, I guess that's our first bug.
DOUG LLOYD: Exactly, now they have a lesson about bugs.
Behind the scenes what's actually happening here,
I think it was actually me this year, we were actually
counting everybody, literally like, 1, 2, 3, 4, like pointing,
and I think maybe there were a couple of us actually
counting different areas of the room to see just how good the class compared
here.
DAVID MALAN: And that's actually a key detail that is very easy to forget,
since there have been years where I forget to ask a member of the staff
to also count because I'm a little too distracted or fazed to do it
in real-time as well accurately.
So I'm producer we've taken a tally from the whole room,
after all of this effort, someone calls out something
and I have nothing to compare it to, so preparation is the key to success
with this demonstration.
DOUG LLOYD: And the other key preparation detail
is that you have a certain program open on your computer to handle--
DAVID MALAN: Yes.
Now you're airing our dirty little secrets.
DOUG LLOYD: --the final tally.
DAVID MALAN: Yeah, no, I am not good at arithmetic
in front of hundreds of people, are even tens of people.
And so I've multiple times like just use my phone
or used an old school calculator and typed in the number,
but invariably I'll forget, did I just type a number and then plus
or did I only type the number now I have to type plus,
and if you hit plus twice it just messes--
DOUG LLOYD: Yeah, you mess up the whole thing.
DAVID MALAN: So I use an old Linux terminal
so I can actually see everything I've typed before actually hitting Enter,
and that seems to help.
DOUG LLOYD: And to me it's a useful tip, it kind of
takes the air out of the demo at the last second
if you can't show them just how buggy the implementation was.
DAVID MALAN: But you have to remember too,
that it's actually helpful to finish the algorithm with students,
so invariably a number of students will be standing up
because they're either too far, or too confused, or too--
DOUG LLOYD: Or too shy.
DAVID MALAN: --socially uncomfortable to like actually pair off,
so I just start calling out at the end to speed things up.
All right, what's your number?
What's your number?
And sort of manually combine people, and so that's
why we end up fixing things at the end there.
And there's [? Myles, ?] one of our own future teaching Fellows
here pictured as a student.
DOUG LLOYD: Indeed.