Data structures and algorithms in Javascript