Ported from Nicholas Zakas' collection of computer science fundamentals, written
in JavaScript. Originals available here:
http://github.com/nzakas/computer-science-in-javascript