Standard algorithms implemented with JavaScript