Some algorithms implemented in JavaScript