{"id":21815317,"url":"https://github.com/thawkin3/js-data-structures-and-algorithms","last_synced_at":"2025-04-14T00:41:29.765Z","repository":{"id":49158929,"uuid":"186063002","full_name":"thawkin3/js-data-structures-and-algorithms","owner":"thawkin3","description":"JavaScript implementations of common data structure and algorithm concepts.","archived":false,"fork":false,"pushed_at":"2022-10-29T21:50:41.000Z","size":10224,"stargazers_count":45,"open_issues_count":0,"forks_count":13,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-27T14:52:33.339Z","etag":null,"topics":["algorithm","algorithm-concepts","algorithms","coding-interviews","computer-science","data-structure","data-structures","data-structures-algorithms","javascript","whiteboard"],"latest_commit_sha":null,"homepage":"http://tylerhawkins.info/js-data-structures-and-algorithms/storybook-dist","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/thawkin3.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-05-10T22:43:13.000Z","updated_at":"2025-03-07T11:42:15.000Z","dependencies_parsed_at":"2022-09-17T13:01:01.788Z","dependency_job_id":null,"html_url":"https://github.com/thawkin3/js-data-structures-and-algorithms","commit_stats":null,"previous_names":[],"tags_count":25,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thawkin3%2Fjs-data-structures-and-algorithms","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thawkin3%2Fjs-data-structures-and-algorithms/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thawkin3%2Fjs-data-structures-and-algorithms/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thawkin3%2Fjs-data-structures-and-algorithms/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thawkin3","download_url":"https://codeload.github.com/thawkin3/js-data-structures-and-algorithms/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248625493,"owners_count":21135513,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["algorithm","algorithm-concepts","algorithms","coding-interviews","computer-science","data-structure","data-structures","data-structures-algorithms","javascript","whiteboard"],"created_at":"2024-11-27T15:17:38.417Z","updated_at":"2025-04-14T00:41:29.727Z","avatar_url":"https://github.com/thawkin3.png","language":"JavaScript","readme":"# JS Data Structures and Algorithms\n\n[![npm](https://img.shields.io/npm/v/js-data-structures-and-algorithms)](https://www.npmjs.com/package/js-data-structures-and-algorithms)\n[![Build Status](https://travis-ci.com/thawkin3/js-data-structures-and-algorithms.svg?branch=master)](https://travis-ci.com/thawkin3/js-data-structures-and-algorithms)\n[![Codecov](https://img.shields.io/codecov/c/github/thawkin3/js-data-structures-and-algorithms)](https://codecov.io/gh/thawkin3/js-data-structures-and-algorithms)\n[![npm bundle size](https://img.shields.io/bundlephobia/minzip/js-data-structures-and-algorithms)](https://bundlephobia.com/result?p=js-data-structures-and-algorithms)\n[![npm](https://img.shields.io/npm/dt/js-data-structures-and-algorithms)](https://www.npmjs.com/package/js-data-structures-and-algorithms)\n[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/)\n[![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg)](https://conventionalcommits.org)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg)](https://github.com/prettier/prettier)\n\nJavaScript implementations of common data structure and algorithm concepts.\n\n## Purpose\n\nThe purpose of this project is to help others learn and understand data\nstructures and algorithms from a JavaScript perspective. Rather than\ncontaining only snippets of code with accompanying explanations, this\nproject is meant to provide an eager learner with fully working code,\ngood test cases, and a playground full of examples.\n\nWhile the primary purpose of this project is education, the data structures\nand algorithms are implemented here as real working code and can be used as\nsuch. This project is published on npm as [js-data-structures-and-algorithms](https://www.npmjs.com/package/js-data-structures-and-algorithms).\n\n## Demos\n\nDemos can be found at: http://tylerhawkins.info/js-data-structures-and-algorithms/storybook-dist\n\n## Data Structures\n\n- [Array](src/data-structures/array/src/array.js)\n- AVL Tree (TODO)\n- [Binary Search Tree](src/data-structures/binary-search-tree/src/binary-search-tree.js)\n- [Doubly Linked List](src/data-structures/doubly-linked-list/src/doubly-linked-list.js)\n- Graph (TODO)\n- [Hash Table (Object)](src/data-structures/hash-table/src/hash-table.js)\n- Heap (TODO)\n- [Linked List](src/data-structures/linked-list/src/linked-list.js)\n- [Node (with only Next pointer)](src/data-structures/linked-list/src/node.js)\n- [Node (with Next and Previous pointers)](src/data-structures/doubly-linked-list/src/node.js)\n- [Priority Queue](src/data-structures/priority-queue/src/priority-queue.js)\n- [Queue (from Array)](src/data-structures/queue/src/queue.js)\n- [Queue (from Doubly Linked List)](src/data-structures/queue/src/queue-from-doubly-linked-list.js)\n- [Set](src/data-structures/set/src/set.js)\n- [Stack (from Array)](src/data-structures/stack/src/stack.js)\n- [Stack (from Linked List)](src/data-structures/stack/src/stack-from-linked-list.js)\n- Trie (TODO)\n\n## Algorithms\n\n### Searching (Array)\n\n- [Binary Search](src/algorithms/search/array/binary-search/src/binary-search.js)\n- [Linear Search](src/algorithms/search/array/linear-search/src/linear-search.js)\n\n### Searching (String)\n\n- [Boyer-Moore-Horspool Search](src/algorithms/search/string/boyer-moore-horspool-search/src/boyer-moore-horspool-search.js)\n- [Naive Search](src/algorithms/search/string/naive-search/src/naive-search.js)\n\n### Searching (Tree and Graph)\n\n- Breadth-First Search (TODO)\n- Depth-First Search (TODO)\n\n### Sorting\n\n- [Bubble Sort](src/algorithms/sort/bubble-sort/src/bubble-sort.js)\n- [Counting Sort](src/algorithms/sort/counting-sort/src/counting-sort.js)\n- Heap Sort (TODO)\n- [Insertion Sort](src/algorithms/sort/insertion-sort/src/insertion-sort.js)\n- [Merge Sort](src/algorithms/sort/merge-sort/src/merge-sort.js)\n- [Quick Sort](src/algorithms/sort/quick-sort/src/quick-sort.js)\n- Radix Sort (TODO)\n- [Selection Sort](src/algorithms/sort/selection-sort/src/selection-sort.js)\n- Shell Sort (TODO)\n\n### Sets\n\n- [Intersection](src/algorithms/set/intersection/src/intersection.js)\n- [Set Difference](src/algorithms/set/set-difference/src/set-difference.js)\n- [Symmetric Difference](src/algorithms/set/symmetric-difference/src/symmetric-difference.js)\n- [Union](src/algorithms/set/union/src/union.js)\n\n## Running the Demos Locally\n\nTo run the Storybook examples locally on your own machine, follow these steps:\n\n1. Clone or download this repo\n2. Install the needed dependencies using `yarn install`\n3. Start up the Storybook app using `yarn storybook`\n\nThat's it! The Storybook app should start running at your localhost on port 9009,\nand the browser tab should be opened for you automatically.\n\n## Using the npm Package in Your App\n\nTo use these data structures and algorithms in your own app, follow these steps:\n\n1. Install the npm package using `yarn add js-data-structures-and-algorithms`\n   (or `npm install js-data-structures-and-algorithms`)\n2. Import any of the exported modules like `import { Stack } from 'js-data-structures-and-algorithms'`\n3. At this point, you're good to instantiate these classes\n   (ex. `const myStack = new Stack()`) and use their methods in your app (ex. `myStack.push(42)`).\n\n## Yarn Commands\n\nFor a complete list, see [package.json](package.json).\n\n- `yarn install`: Installs dependencies\n- `yarn storybook`: Starts up the Storybook app locally so you can view the demos and examples\n- `yarn build-storybook`: Builds a static site out of the Storybook app (this is what is hosted here:\n  http://tylerhawkins.info/js-data-structures-and-algorithms/storybook-dist)\n- `yarn build`: Generates the minified build from the source code using [Rollup](https://rollupjs.org/)\n- `yarn test`: Runs all tests\n- `yarn test:coverage`: Runs all tests and includes coverage report\n- `yarn test:logs`: Runs tests in watch mode and includes console log output to show the internals\n  of what is going on during each iteration of algorithms being run (for\n  instance, it shows the current state of an array that is being sorted during\n  each step of the given algorithm)\n- `yarn test:watch`: Runs tests in watch mode\n- `yarn prettier`: Formats the code so you don't have to worry about white space and other\n  formatting during development\n- `yarn prettier-watch`: Runs prettier in watch mode\n- `yarn eslint`: Runs eslint to lint JS files\n- `yarn stylelint`: Lints CSS files and auto-fixes issues where possible\n- `yarn cz`: Uses [commitizen](https://github.com/commitizen/cz-cli)\n  to walk you through some steps via the cli and then\n  commits your code using a formatted commit message that\n  it generates\n- `yarn release`: Bumps the package version and generates the changelog using\n  [standard-version](https://github.com/conventional-changelog/standard-version)\n\n## Contributing\n\nPlease see the [Contributing Guidelines](CONTRIBUTING.md).\n\n## Code of Conduct\n\nThe [Code of Conduct](CODE_OF_CONDUCT.md) can be found here.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthawkin3%2Fjs-data-structures-and-algorithms","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthawkin3%2Fjs-data-structures-and-algorithms","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthawkin3%2Fjs-data-structures-and-algorithms/lists"}