Several different basic algorithms implemented in JavaScript