Implementations of some algorithms in JavaScript