Skip to content

JCPedroza/algorithms-and-data-structures-js

Repository files navigation

JavaScript Algorithms & Data Structures

node npm

Standard Style Guide

license MIT build status

This is a living notebook, created to:

  • Practice:
    • JavaScript
    • Algorithms & data structures
    • Unit testing
    • JS static type check (with jsdoc and tsc)
    • Git
  • Solve programming challenges.
  • Compare the running time of different implementations.
  • Contain general notes about the solutions (explanations, very simple complexity analysis, optimizations, references, etc.).

To solve a project, write your solution and add it to the array inside <project>.repo.js. This will include it in unit testing and execution time measurements.

Main Commands

npm test # Run unit tests for all projects (or from current location)
npm test <path to test.js file> # Run unit tests for one project
npm run full-test # Run unit tests and linter
# Run execution time measurement for one project
node <path to time.js file>

# Example
node src/project-euler/001-multiples-of-3-or-5/mults-of-3-or-5.time.js

Installation

First make sure you have both the node.js runtime and the npm package manager installed. You can install them using the official page or nvm.

Then:

git clone https://github.com/JCPedroza/algorithms-and-data-structures-js.git
cd algorithms-and-data-structures-js
npm install

Usage

Run Unit Tests

node --test # Verbose, human readable
node --test --test-reporter dot # Minimal verbosity
npm test # Npm script

You can include a path after any of the above to run unit tests for one specific project.

Measure Execution Time

node <path to time.js file>

Run Linter

npx standard . # Run using npx
npm run lint-test # Run using npm script

See Available npm run Scripts

npm run

Contributing

Have a new interesting solution? Found a bug, mistake, typo, or similar? Pull requests are very welcome!

contributors commit activity issues issues closed issues pr issues pr closed