francishero / pretty-algorithms

🌊 Pretty common and useful algorithms with modern JS

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Pretty algorithms

Common useful algorithms written in modern, pretty and easy-to-understand Javascript. Typescript has been used only for type checking and better auto-documentation, code is in pure ES6.

All the algorithms are also tested using Jest with the help of custom nice-to-read diffs for data structures.

Jest

Note

The purpose of this repository is to show algorithms written using declarative and intuitive code as much as possible. It's not meant to be used as production.

If you need something absolutely performant in production try checking felipernb/algorithms.js with low-level optimisations.

Check also this article about pros and cons of common sorting algorithms.

Content

Miscellanous

Search

Sort

Usage

You can play around with the code cloning the repo and running the following commands:

npm install # or yarn install
npm test # or yarn test

Play around with the source code, the tests and learn the algorithms! You can also run the following command to put tests in watch mode and auto-run with changes. Jest CLI output is awesome!

npm run test -- --watch

Jest

TODO

  • Add a real-world usage example of every algorithm
  • Add benchmarks

About

🌊 Pretty common and useful algorithms with modern JS


Languages

Language:TypeScript 95.4%Language:JavaScript 4.6%