- Notifications
You must be signed in to change notification settings - Fork13
JavaScript implementations of common data structure and algorithm concepts.
License
thawkin3/js-data-structures-and-algorithms
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
JavaScript implementations of common data structure and algorithm concepts.
The purpose of this project is to help others learn and understand datastructures and algorithms from a JavaScript perspective. Rather thancontaining only snippets of code with accompanying explanations, thisproject 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 structuresand algorithms are implemented here as real working code and can be used assuch. This project is published on npm asjs-data-structures-and-algorithms.
Demos can be found at:http://tylerhawkins.info/js-data-structures-and-algorithms/storybook-dist
- Array
- AVL Tree (TODO)
- Binary Search Tree
- Doubly Linked List
- Graph (TODO)
- Hash Table (Object)
- Heap (TODO)
- Linked List
- Node (with only Next pointer)
- Node (with Next and Previous pointers)
- Priority Queue
- Queue (from Array)
- Queue (from Doubly Linked List)
- Set
- Stack (from Array)
- Stack (from Linked List)
- Trie (TODO)
- Breadth-First Search (TODO)
- Depth-First Search (TODO)
- Bubble Sort
- Counting Sort
- Heap Sort (TODO)
- Insertion Sort
- Merge Sort
- Quick Sort
- Radix Sort (TODO)
- Selection Sort
- Shell Sort (TODO)
To run the Storybook examples locally on your own machine, follow these steps:
- Clone or download this repo
- Install the needed dependencies using
yarn install
- 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.
To use these data structures and algorithms in your own app, follow these steps:
- Install the npm package using
yarn add js-data-structures-and-algorithms
(ornpm install js-data-structures-and-algorithms
) - Import any of the exported modules like
import { Stack } from 'js-data-structures-and-algorithms'
- 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)
).
For a complete list, seepackage.json.
yarn install
: Installs dependenciesyarn storybook
: Starts up the Storybook app locally so you can view the demos and examplesyarn 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 usingRollupyarn test
: Runs all testsyarn test:coverage
: Runs all tests and includes coverage reportyarn test:logs
: Runs tests in watch mode and includes console log output to show the internalsof what is going on during each iteration of algorithms being run (forinstance, it shows the current state of an array that is being sorted duringeach step of the given algorithm)yarn test:watch
: Runs tests in watch modeyarn prettier
: Formats the code so you don't have to worry about white space and otherformatting during developmentyarn prettier-watch
: Runs prettier in watch modeyarn eslint
: Runs eslint to lint JS filesyarn stylelint
: Lints CSS files and auto-fixes issues where possibleyarn cz
: Usescommitizento walk you through some steps via the cli and thencommits your code using a formatted commit message thatit generatesyarn release
: Bumps the package version and generates the changelog usingstandard-version
Please see theContributing Guidelines.
TheCode of Conduct can be found here.
About
JavaScript implementations of common data structure and algorithm concepts.
Topics
Resources
License
Code of conduct
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Uh oh!
There was an error while loading.Please reload this page.