GithubHelp home page GithubHelp logo

thawkin3 / js-data-structures-and-algorithms Goto Github PK

View Code? Open in Web Editor NEW
44.0 4.0 12.0 9.98 MB

JavaScript implementations of common data structure and algorithm concepts.

Home Page: http://tylerhawkins.info/js-data-structures-and-algorithms/storybook-dist

License: MIT License

HTML 4.45% JavaScript 91.13% CSS 4.42%
javascript algorithms algorithm data-structures data-structure data-structures-algorithms coding-interviews computer-science whiteboard algorithm-concepts

js-data-structures-and-algorithms's Introduction

JS Data Structures and Algorithms

npm Build Status Codecov npm bundle size npm Commitizen friendly Conventional Commits License: MIT code style: prettier

JavaScript implementations of common data structure and algorithm concepts.

Purpose

The purpose of this project is to help others learn and understand data structures and algorithms from a JavaScript perspective. Rather than containing only snippets of code with accompanying explanations, this project is meant to provide an eager learner with fully working code, good test cases, and a playground full of examples.

While the primary purpose of this project is education, the data structures and algorithms are implemented here as real working code and can be used as such. This project is published on npm as js-data-structures-and-algorithms.

Demos

Demos can be found at: http://tylerhawkins.info/js-data-structures-and-algorithms/storybook-dist

Data Structures

Algorithms

Searching (Array)

Searching (String)

Searching (Tree and Graph)

  • Breadth-First Search (TODO)
  • Depth-First Search (TODO)

Sorting

Sets

Running the Demos Locally

To run the Storybook examples locally on your own machine, follow these steps:

  1. Clone or download this repo
  2. Install the needed dependencies using yarn install
  3. Start up the Storybook app using yarn storybook

That's it! The Storybook app should start running at your localhost on port 9009, and the browser tab should be opened for you automatically.

Using the npm Package in Your App

To use these data structures and algorithms in your own app, follow these steps:

  1. Install the npm package using yarn add js-data-structures-and-algorithms (or npm install js-data-structures-and-algorithms)
  2. Import any of the exported modules like import { Stack } from 'js-data-structures-and-algorithms'
  3. At this point, you're good to instantiate these classes (ex. const myStack = new Stack()) and use their methods in your app (ex. myStack.push(42)).

Yarn Commands

For a complete list, see package.json.

  • yarn install: Installs dependencies
  • yarn storybook: Starts up the Storybook app locally so you can view the demos and examples
  • yarn build-storybook: Builds a static site out of the Storybook app (this is what is hosted here: http://tylerhawkins.info/js-data-structures-and-algorithms/storybook-dist)
  • yarn build: Generates the minified build from the source code using Rollup
  • yarn test: Runs all tests
  • yarn test:coverage: Runs all tests and includes coverage report
  • yarn test:logs: Runs tests in watch mode and includes console log output to show the internals of what is going on during each iteration of algorithms being run (for instance, it shows the current state of an array that is being sorted during each step of the given algorithm)
  • yarn test:watch: Runs tests in watch mode
  • yarn prettier: Formats the code so you don't have to worry about white space and other formatting during development
  • yarn prettier-watch: Runs prettier in watch mode
  • yarn eslint: Runs eslint to lint JS files
  • yarn stylelint: Lints CSS files and auto-fixes issues where possible
  • yarn cz: Uses commitizen to walk you through some steps via the cli and then commits your code using a formatted commit message that it generates
  • yarn release: Bumps the package version and generates the changelog using standard-version

Contributing

Please see the Contributing Guidelines.

Code of Conduct

The Code of Conduct can be found here.

js-data-structures-and-algorithms's People

Contributors

thawkin3 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.