
Algorithms on Khan Academy – a collaboration with Dartmouth College professors - pamelafox
http://cs-blog.khanacademy.org/2014/11/teaching-algorithms-on-khan-academy.html
======
pamelafox
I'm Pamela, from Khan Academy. I worked with Cormen and Balkcom on the
curriculum over the summer, and learned a lot myself while creating it (I
don't remember my uni ever talking about Big-Theta!). I hope that this
curriculum will be useful for the range of people interested in algorithms,
from high schoolers to engineers studying for interviews.

If you have feedback on any of the coding challenges, please click "Report a
problem". The automated graders start off strict, and I adjust those based on
student feedback.

If you have feedback about other parts, please email compsci-feedback at
khanacademy.org or pamela @.

~~~
bhaumik
YES! Thanks so much for helping put this together.

I've spent a lot of time looking for valuable resources on Algorithms, Data
Structures, and other CS theory concepts. CLRS was highly recommended but
without a technical background, I wasn't able to dive in as quickly as I
hoped. A few days ago, I purchased a copy of Algorithms Unlocked [1] which was
described as a "prequel" to CLRS. This review in particular grabbed my
attention: "The people who will get the most out of this book are self-taught
programmers who have never taken a course in algorithms but who nevertheless
need to know this material." Hopefully there isn't too much overrlap :)

BTW, the crytopgraphy & information theory units [2] also look promising.

[1] [http://www.amazon.com/Algorithms-Unlocked-Thomas-H-
Cormen/dp...](http://www.amazon.com/Algorithms-Unlocked-Thomas-H-
Cormen/dp/0262518805)

[2] [https://www.khanacademy.org/computing/computer-
science](https://www.khanacademy.org/computing/computer-science)

~~~
pamelafox
Yes, Cormen thinks that Algorithms Unlocked is actually a much better book for
the crowd that would likely use this content. I put more links in this article
at the end, with recommendations from someone who runs an Algorithms study
group for mostly self-taught programmers:
[https://www.khanacademy.org/computing/computer-
science/algor...](https://www.khanacademy.org/computing/computer-
science/algorithms/algorithms-more-learning/a/where-to-go-from-here)

The crypto one has a lot of well done videos by Brit Cruise, I've been going
through that one personally myself. The info theory is also done by Brit and
likely just as cool. There is no programming in either of those, though you
can see how they programmed a few visualizations.

------
egonschiele
Hey there, I'm working on an algorithms book myself:
[http://www.manning.com/bhargava/](http://www.manning.com/bhargava/)

It is meant to be an easier read than CLRS, so I'm excited to see that Khan
Academy is thinking along the same lines! I have been thinking about how to
make algorithms easier to understand for the last year, so I have some
feedback. Some of it is critical, so first I want to say how much I LOVE that
Khan Academy is doing this. I really like the interactive nature of this, and
I really like that you have comments. I think that's one advantage of e-books
vs traditional books: you can't comment on a paper book. I like the sequencing
too (it is very similar to my table of contents, which is cool to see).

What I don't like:

I don't understand why you have four sorting algorithms here. What does
insertion sort add over selection sort? I chose to only include selection sort
and quicksort in my book. I think once you know those two, you can figure out
insertion sort and merge sort if needed. It doesn't add a lot for the
reader...I would rather they spend mental effort learning something new.

Similarly, why include big-omega notation? I use a writing principle called
"just-in-time" vs "just-in-case". It feels like Big-Omega notation was
included "just in case" the reader needs to know it for a later section. I
would rather it be taught "just-in-time", i.e. right when the reader _needs_
to know big-omega notation to proceed.

I struggled with the recursion section. My challenge was:

\- come up with a real-world example that uses recursion.

\- come up with an example where the recursive solution is more elegant than a
while loop. Otherwise, why use recursion?

It looks like you had the same challenges. I wish you guys would swap out the
factorial example for something that solves a real problem: looking through a
directory for a file, for example.

It would be great to see more interactivity in the harder sections too. For
example, in "overview of quicksort", I would like to see an animation of the
sorting (I am a visual learner).

Overall this is still amazing. Algorithms are such a core topic, and there are
no good resources for beginners out there. Very happy to see Khan Academy take
this step.

~~~
pamelafox
Great feedback!

I think it helps to have both the sorts there, because it gives the students
another opportunity to solidify their understanding of algorithms and because
they are indeed expected in things like AP CS. Personally, I find them
different enough that I need to spend time on each of them to grasp them- I
always have to draw algorithms out when I'm learning them, so it helped me
that we had the different diagrams and visualizations for each one.

When making KA content, we have to think both about the student that's going
through the content from top to bottom and the student that's "snacking" on
the content, like finding it via Google search. So if you knew that a student
was going to do the whole thing, you could do more just-in-time teaching - but
if you didn't know, then it'd be doing a disservice to the snacker to leave
out something like Big O notation, because it'd sure be strange if someone
learned Theta and Omega and came away not knowing that last one existed. We
did spend a while restructuring asymptotic notation in particular, that was
one of the topics we debated different approaches to.

We also debated the use cases for recursion, and if we should include the
classic factorial challenge. We went for it in the end, as you saw. I think
recursive art is my favorite, and works well in our ProcessingJS environment,
but one could argue if that's real world :-) I believe that Devin is working
on another tutorial with recursion and specifically on how students can come
up with their _own_ recursive algorithm. I'll suggest the looking through
directory example to him.

Yep, we are working on a quick sort visualization. I am also quite a visual
learner.

The neat thing about online curriculum is that we can get feedback from all
the students that use it and improve it over time. We'll probably look at all
the feedback in a few months, once it's been out there for a bit, see where
the dropoff points are, see what the common questions are, and use that to
decide what needs changing.

~~~
devnonymous
Just to address the recursion point that the GP brought up. Here is one of the
best explanations I saw where the problem not only lends itself to a recursive
solution but where the recursive solution is actually the more intuitive one
rather than a loop. Also it explains with 'real-world' problems, albeit in the
context of the material (game programming):

[http://inventwithpython.com/blog/2011/08/11/recursion-
explai...](http://inventwithpython.com/blog/2011/08/11/recursion-explained-
with-the-flood-fill-algorithm-and-zombies-and-cats/)

------
riprock
Just curious, but any chance of Khan Academy adding Discrete Mathematics?
Correct me if I am wrong but I don't think coursera/udemy have a course
either. The only free online course I am aware of for Discrete Mathematics is
MIT OCW 6.042J.

~~~
vijaygj
Descrete Math is so important to understand the analysis of the algorithms
(esp. a new problem). However, I did not find any useful course except the one
you mentioned.

~~~
mikemajzoub
Berkley's Discrete Math class is solid. Lectures on Youtube:
[http://www.youtube.com/playlist?list=PL-XXv-
cvA_iDTidF2dnVq_...](http://www.youtube.com/playlist?list=PL-XXv-
cvA_iDTidF2dnVq_8lqoigCNSEL)

~~~
vijaygj
This looks latest (fall 2014). Thanks :) Will try it out, I was looking for
descrete mathematics course almost 2 years back and could find only MIT one.
Good to see some options now.

------
CodeCube
Just wanted to say thanks, and keep on doing the great work you're doing. KA
is one of those places doing good in the world :)

------
voltagex_
The editor for the exercises is based on ProcessingJS -
[http://processingjs.org/](http://processingjs.org/).

------
voltagex_
The interactive editor is really cool. Playing around with the drawing
functions can create some cool visualisations of the algorithms.

~~~
jeresig
Yeah! We have full curriculum around it, as well (Intro to JavaScript, Game
development, and Natural Simulations):
[https://www.khanacademy.org/computing/computer-
programming](https://www.khanacademy.org/computing/computer-programming)

It uses a real-time JavaScript editing framework that we're in the process of
open sourcing: [https://github.com/Khan/live-
editor](https://github.com/Khan/live-editor)

A technical talk on the editor (a bit dated at this point, but most of the
points still hold) can be found here: [http://ejohn.org/blog/talk-khan-
academy-computer-science/](http://ejohn.org/blog/talk-khan-academy-computer-
science/)

~~~
voltagex_
What's the difference between the editor on the course page and the one in the
repo?

~~~
jeresig
None - other than on the course page you can save your progress. A simple demo
of the open source editor can be found here: [https://khan.github.io/live-
editor/demos/simple/](https://khan.github.io/live-editor/demos/simple/)

------
cenhyperion
This looks really useful!

