Algorithms and data structures in javascript