{"id":13447162,"url":"https://github.com/amejiarosario/dsa.js-data-structures-algorithms-javascript","last_synced_at":"2025-05-14T04:03:15.573Z","repository":{"id":38419607,"uuid":"77558427","full_name":"amejiarosario/dsa.js-data-structures-algorithms-javascript","owner":"amejiarosario","description":"🥞Data Structures and Algorithms explained and implemented in JavaScript + eBook","archived":false,"fork":false,"pushed_at":"2024-01-30T12:03:50.000Z","size":115442,"stargazers_count":7685,"open_issues_count":7,"forks_count":931,"subscribers_count":114,"default_branch":"master","last_synced_at":"2025-04-10T22:34:56.160Z","etag":null,"topics":["algorithm","algorithms","book","coding-interviews","computer-science","data-structures","graph","heap","javascript","javascript-algorithms","search","tree"],"latest_commit_sha":null,"homepage":"https://books.adrianmejia.com","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/amejiarosario.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"amejiarosario","patreon":"amejiarosario","custom":"https://adrianmejia.com/support/"}},"created_at":"2016-12-28T20:09:24.000Z","updated_at":"2025-04-09T14:52:58.000Z","dependencies_parsed_at":"2024-06-18T13:56:09.822Z","dependency_job_id":"cf85ce74-c2c8-462a-b777-fe89d6a40dda","html_url":"https://github.com/amejiarosario/dsa.js-data-structures-algorithms-javascript","commit_stats":{"total_commits":733,"total_committers":25,"mean_commits":29.32,"dds":0.6030013642564802,"last_synced_commit":"844644d29fea200916cd42cadf8990ca893344ca"},"previous_names":["amejiarosario/dsa.js"],"tags_count":53,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amejiarosario%2Fdsa.js-data-structures-algorithms-javascript","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amejiarosario%2Fdsa.js-data-structures-algorithms-javascript/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amejiarosario%2Fdsa.js-data-structures-algorithms-javascript/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amejiarosario%2Fdsa.js-data-structures-algorithms-javascript/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/amejiarosario","download_url":"https://codeload.github.com/amejiarosario/dsa.js-data-structures-algorithms-javascript/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254067143,"owners_count":22009087,"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","algorithms","book","coding-interviews","computer-science","data-structures","graph","heap","javascript","javascript-algorithms","search","tree"],"created_at":"2024-07-31T05:01:09.828Z","updated_at":"2025-05-14T04:03:15.507Z","avatar_url":"https://github.com/amejiarosario.png","language":"JavaScript","readme":"![image](https://user-images.githubusercontent.com/418605/59557258-10742880-8fa3-11e9-84fb-4d66a9d89faa.png)\n\n# Data Structures and Algorithms in JavaScript\n\n[![CircleCI](https://circleci.com/gh/amejiarosario/dsa.js-data-structures-algorithms-javascript.svg?style=shield)](https://app.circleci.com/pipelines/github/amejiarosario/dsa.js-data-structures-algorithms-javascript) [![NPM version](https://badge.fury.io/js/dsa.js.svg)](https://badge.fury.io/js/dsa.js) [![chat](https://dsajs-slackin.herokuapp.com/badge.svg)](https://dsajs-slackin.herokuapp.com)\n\n\u003e This is the coding implementations of the [DSA.js book](https://books.adrianmejia.com/dsajs-data-structures-algorithms-javascript/) and the repo for the NPM package.\n\n\u003e In this repository, you can find the implementation of algorithms and data structures in JavaScript.  This material can be used as a reference manual for developers, or you can refresh specific topics before an interview. Also, you can find ideas to solve problems more efficiently.\n\n\u003c!-- (Check out the Time Complexity Cheatsheet) --\u003e\n\n\n\u003c!--\n[![CircleCI](https://circleci.com/gh/amejiarosario/dsa.js-data-structures-and-algorithms-in-javascript.svg?style=svg)](https://circleci.com/gh/amejiarosario/dsa.js-data-structures-and-algorithms-in-javascript)\n[![Code Style Airbnb](https://img.shields.io/badge/code%20style-Airbnb-brightgreen.svg)](https://github.com/airbnb/javascript)\n[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](http://makeapullrequest.com)\n[![ProductHunt](https://img.shields.io/badge/product%20hunt-vote-orange.svg)](https://www.producthunt.com/posts/dsa-js)\nhttps://bundlephobia.com/result?p=dsa.js\nhttps://img.shields.io/bundlephobia/min/dsa.js.svg - 16.7kB\nhttps://img.shields.io/github/repo-size/amejiarosario/dsa.js.svg - 98.1 MB\n--\u003e\n\n![Interactive Data Structures](https://user-images.githubusercontent.com/418605/46118890-ba721180-c1d6-11e8-82bc-6a671428b422.png)\n\u003c!-- [](https://embed.kumu.io/85f1a4de5fb8430a10a1bf9c5118e015) --\u003e\n\n\n## Table of Contents\n\n\u003c!-- START doctoc generated TOC please keep comment here to allow auto update --\u003e\n\u003c!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE --\u003e\n\n\n- [Installation](#installation)\n- [Features](#features)\n- [What's Inside](#whats-inside)\n  - [📈 Algorithms Analysis](#-algorithms-analysis)\n  - [🥞 Linear Data Structures](#-linear-data-structures)\n  - [🌲 Non-Linear Data Structures](#-non-linear-data-structures)\n  - [⚒ Algorithms Techniques](#%E2%9A%92-algorithms-techniques)\n- [Book](#book)\n- [FAQ](#faq)\n- [Support](#support)\n- [License](#license)\n\n\n\u003c!-- END doctoc generated TOC please keep comment here to allow auto update --\u003e\n\n\n## Installation\n\nYou can clone the repo or install the code from NPM:\n\n```sh\nnpm install dsa.js\n```\n\nand then you can import it into your programs or CLI\n\n```js\nconst { LinkedList, Queue, Stack } = require('dsa.js');\n```\n\nFor a list of all available data structures and algorithms, [see index.js](src/index.js).\n\n\n## Features\n\nAlgorithms are an essential toolbox for every programmer.\n\nYou will need to mind algorithms runtime when you have to sort data, search for a value in a big dataset, transform data, scale your code to many users, to name a few.\nAlgorithms are just the step you follow to solve a problem, while data structures are where you store the data for later manipulation. Both combined create programs.\n\n\u003e Algorithms + Data Structures = Programs.\n\nMost programming languages and libraries indeed provide implementations for basic data structures and algorithms.\nHowever, to make use of data structures properly, you have to know the tradeoffs to choose the best tool for the job.\n\nThis material is going to teach you to:\n\n- 🛠 Apply strategies to tackle algorithm questions. Never to get stuck again. Ace those interviews!\n- ✂️ Construct efficient algorithms. Learn how to break down problems into manageable pieces.\n- 🧠 Improve your problem-solving skills and become a well-rounded developer by understanding fundamental computer science concepts.\n- 🤓 Cover essential topics, such as big O time, data structures, and must-know algorithms. Implement 10+ data structures from scratch.\n\n## What's Inside\n\nAll the code and explanations are available on this repo. You can dig through the links and code examples from the ([src folder](src)). However, the inline code examples are not expanded (because of Github's asciidoc limitations), but you can follow the path and see the implementation.\n\n_Note: If you prefer to consume the information more linearly, then the [book format](https://books.adrianmejia.com/dsajs-data-structures-algorithms-javascript/) would be more appropriate for you._\n\nThe topics are divided into four main categories, as you can see below:\n\n\n### 📈 [Algorithms Analysis](book/part01-algorithms-analysis.asc)\n\n\u003c!-- - Computer Science nuggets without all the mumbo-jumbo.\n- Learn how to compare algorithms using Big O notation.\n- 8 examples to explain with code how to calculate time complexity. --\u003e\n\n\u003cblockquote\u003e\n\n\u003cdetails\u003e\n  \u003csummary\u003e\n    Computer Science nuggets without all the mumbo-jumbo. \u003ci\u003e(Click to expand)\u003c/i\u003e\n  \u003c/summary\u003e\n\n---\n\n### [Computer Science nuggets without all the mumbo-jumbo](book/content/part01/algorithms-analysis.asc)\n\n#### Learn to calculate run time from code examples\n\n![Translating lines of code to an approximate number of operations](book/images/image4.png)\n\n---\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n  \u003csummary\u003e\n    Learn how to compare algorithms using Big O notation. \u003ci\u003e(Click to expand)\u003c/i\u003e\n  \u003c/summary\u003e\n\n---\n\n### [Learn how to compare algorithms using Big O notation.](book/content/part01/big-o-examples.asc#finding-if-an-array-is-empty)\n\n#### Comparing algorithms using Big O notation\n\nLet's say you want to find the duplicates on an array.\nUsing Big O notation, we can compare different solutions that solve the same problem but has a massive difference in how long it takes to do it.\n\n- [Optimal solution using a map](book/content/part01/big-o-examples.asc#linear-example)\n- [Finding duplicates in an array (naïve approach)](book/content/part01/big-o-examples.asc#quadratic-example)\n\n---\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n  \u003csummary\u003e\n    8 examples to explain with code how to calculate time complexity. \u003ci\u003e(Click to expand)\u003c/i\u003e\n  \u003c/summary\u003e\n\n---\n\n[8 examples to explain with code how to calculate time complexity](book/content/part01/big-o-examples.asc#summary)\n\n#### Most common time complexities\n\n[![image](https://user-images.githubusercontent.com/418605/59617342-2a715080-90f4-11e9-9de9-9315fb0133f9.png)](book/content/part01/big-o-examples.asc#summary)\n\n\u003c!-- - Constant time: _O(1)_\n- Logarithmic time: _O(log n)_\n- Linear time: _O(n)_\n- Linearithmic time: _O(n log n)_\n- Quadratic time: _O(n^2^)_\n- Cubic time: _O(n^3^)_\n- Exponential time: _O(2^n^)_\n- Factorial time: _O(n!)_ --\u003e\n\n#### Time complexity graph\n\n![Most common time complexities](book/images/image5.png)\n\n---\n\n\u003c/details\u003e\n\u003c/blockquote\u003e\n\n### 🥞 [Linear Data Structures](book/part02-linear-data-structures.asc)\n\n\u003c!-- - Understand the ins and outs of the most common data structures.\n- When to use an Array or Linked List. Know the tradeoffs.\n- Build a Stack and a Queue from scratch. --\u003e\n\n\u003cblockquote\u003e\n\n  \u003cdetails\u003e\n    \u003csummary\u003e\n      Understand the ins and outs of the most common data structures. \u003ci\u003e(Click to expand)\u003c/i\u003e\n    \u003c/summary\u003e\n\n---\n\n#### [Understand the ins and outs of the most common data structures](book/part02-linear-data-structures.asc)\n\n\n- [Arrays](book/content/part02/array.asc): Built-in in most languages so not implemented here. [Array Time complexity](book/content/part02/array.asc#array-complexity)\n    \u003c!-- [Post](https://adrianmejia.com/blog/2018/04/28/data-structures-time-complexity-for-beginners-arrays-hashmaps-linked-lists-stacks-queues-tutorial/#Array). --\u003e\n\n- [Linked List](book/content/part02/linked-list.asc): each data node has a link to the next (and\n    previous).\n    [Code](src/data-structures/linked-lists/linked-list.js)\n    |\n    [Linked List Time Complexity](book/content/part02/linked-list.asc#linked-list-complexity-vs-array-complexity)\n    \u003c!-- [Post](https://adrianmejia.com/blog/2018/04/28/data-structures-time-complexity-for-beginners-arrays-hashmaps-linked-lists-stacks-queues-tutorial/#Linked-Lists) --\u003e\n\n- [Queue](book/content/part02/queue.asc): data flows in a \"first-in, first-out\" (FIFO) manner.\n    [Code](src/data-structures/queues/queue.js)\n    |\n    [Queue Time Complexity](book/content/part02/queue.asc#queue-complexity)\n    \u003c!-- [Post](https://adrianmejia.com/blog/2018/04/28/data-structures-time-complexity-for-beginners-arrays-hashmaps-linked-lists-stacks-queues-tutorial/#Queues) --\u003e\n\n- [Stack](book/content/part02/stack.asc): data flows in a \"last-in, first-out\" (LIFO) manner.\n    [Code](src/data-structures/stacks/stack.js)\n    |\n    [Stack Time Complexity](book/content/part02/stack.asc#stack-complexity)\n    \u003c!-- [Post](https://adrianmejia.com/blog/2018/04/28/data-structures-time-complexity-for-beginners-arrays-hashmaps-linked-lists-stacks-queues-tutorial/#Stacks) --\u003e\n\n---\n\n  \u003c/details\u003e\n  \u003cdetails\u003e\n    \u003csummary\u003e\n      When to use an Array or Linked List. Know the tradeoffs. \u003ci\u003e(Click to expand)\u003c/i\u003e\n    \u003c/summary\u003e\n\n---\n\n#### [When to use an Array or Linked List. Know the tradeoffs](book/content/part02/array-vs-list-vs-queue-vs-stack.asc)\n\nUse Arrays when…\n- You need to access data in random order fast (using an index).\n- Your data is multi-dimensional (e.g., matrix, tensor).\n\nUse Linked Lists when:\n- You will access your data sequentially.\n- You want to save memory and only allocate memory as you need it.\n- You want constant time to remove/add from extremes of the list.\n- when size requirement is unknown - dynamic size advantage\n\n---\n\n  \u003c/details\u003e\n  \u003cdetails\u003e\n    \u003csummary\u003e\n      Build a List, Stack, and a Queue. \u003ci\u003e(Click to expand)\u003c/i\u003e\n    \u003c/summary\u003e\n\n  ---\n\n  #### [Build a List, Stack and a Queue from scratch](book/part02-linear-data-structures.asc)\n\n  Build any of these data structures from scratch:\n  - [Linked List](src/data-structures/linked-lists/linked-list.js)\n  - [Stack](src/data-structures/stacks/stack.js)\n  - [Queue](src/data-structures/queues/queue.js)\n\n  ---\n\n  \u003c/details\u003e\n\u003c/blockquote\u003e\n\n### 🌲 [Non-Linear Data Structures](book/part03-graph-data-structures.asc)\n\u003c!-- - Understand one of the most versatile data structure of all: Maps --\u003e\n\u003c!-- - Know the properties of Graphs and Trees. --\u003e\n\u003c!-- - Implement a binary search tree for fast lookups. --\u003e\n\n\u003cblockquote\u003e\n  \u003cdetails\u003e\n    \u003csummary\u003e\n      Understand one of the most versatile data structure of all: Hash Maps. \u003ci\u003e(Click to expand)\u003c/i\u003e\n    \u003c/summary\u003e\n\n---\n\n#### [HashMaps](book/content/part03/map.asc)\n\nLearn how to implement different types of Maps such as:\n- [HashMap](book/content/part02/hash-map.asc)\n- [TreeMap](book/content/part03/tree-map.asc)\n\nAlso, [learn the difference between the different Maps implementations](book/content/part03/time-complexity-graph-data-structures.asc):\n\n- `HashMap` is more time-efficient. A `TreeMap` is more space-efficient.\n- `TreeMap` search complexity is *O(log n)*, while an optimized `HashMap` is *O(1)* on average.\n- `HashMap`’s keys are in insertion order (or random depending on the implementation). `TreeMap`’s keys are always sorted.\n- `TreeMap` offers some statistical data for free such as: get minimum, get maximum, median, find ranges of keys. `HashMap` doesn’t.\n- `TreeMap` has a guarantee always an *O(log n)*, while `HashMap`s has an amortized time of *O(1)* but in the rare case of a rehash, it would take an *O(n)*.\n\n---\n\n  \u003c/details\u003e\n\n  \u003cdetails\u003e\n    \u003csummary\u003e\n    Know the properties of Graphs and Trees. \u003ci\u003e(Click to expand)\u003c/i\u003e\n    \u003c/summary\u003e\n\n---\n\n#### [Know the properties of Graphs and Trees](book/part03-graph-data-structures.asc)\n\n##### [Graphs](book/content/part03/graph.asc)\n\nKnow all the graphs properties with many images and illustrations.\n\n![graph example with USA airports](book/images/image46.png)\n\n **Graphs**: data **nodes** that can have a connection or **edge** to\n    zero or more adjacent nodes. Unlike trees, nodes can have multiple parents, loops.\n    [Code](src/data-structures/graphs/graph.js)\n    |\n    [Graph Time Complexity](book/content/part03/graph.asc#graph-complexity)\n\n#### [Trees](book/content/part03/tree-intro.asc)\n\nLearn all the different kinds of trees and their properties.\n\n![tree data structure properties](book/images/image31.jpg)\n\n- **Trees**: data nodes has zero or more adjacent nodes a.k.a.\n    children. Each node can only have one parent node otherwise is a\n    graph, not a tree.\n    [Code](src/data-structures/trees)\n    |\n    [Docs](book/content/part03/tree-intro.asc)\n    \u003c!-- [Post](https://adrianmejia.com/blog/2018/06/11/data-structures-for-beginners-trees-binary-search-tree-tutorial/) --\u003e\n\n    - **Binary Trees**: same as a tree but only can have two children at\n        most.\n        [Code](src/data-structures/trees)\n        |\n        [Docs](book/content/part03/tree-intro.asc#binary-tree)\n        \u003c!-- [Post](https://adrianmejia.com/blog/2018/06/11/data-structures-for-beginners-trees-binary-search-tree-tutorial/#Binary-Trees) --\u003e\n\n    - **Binary Search Trees** (BST): same as a binary tree, but the\n        nodes value keep this order `left \u003c parent \u003c right`.\n        [Code](src/data-structures/trees/binary-search-tree.js)\n        |\n        [BST Time complexity](book/content/part03/binary-search-tree.asc#tree-complexity)\n        \u003c!-- [Post](https://adrianmejia.com/blog/2018/06/11/data-structures-for-beginners-trees-binary-search-tree-tutorial/#Binary-Search-Tree-BST) --\u003e\n\n    - **AVL Trees**: Self-balanced BST to maximize lookup time.\n        [Code](src/data-structures/trees/avl-tree.js)\n        |\n        [AVL Tree docs](book/C-AVL-tree.asc)\n        |\n        [Self-balancing \u0026 tree rotations docs](book/B-self-balancing-binary-search-trees.asc)\n        \u003c!-- [Post](https://adrianmejia.com/blog/2018/07/16/self-balanced-binary-search-trees-with-avl-tree-data-structure-for-beginners/) --\u003e\n\n    - **Red-Black Trees**: Self-balanced BST looser than AVL to\n        maximize insertion speed.\n        [Code](src/data-structures/trees/red-black-tree.js)\n\n---\n\n  \u003c/details\u003e\n\n  \u003cdetails\u003e\n    \u003csummary\u003e\n      Implement a binary search tree for fast lookups.\n    \u003c/summary\u003e\n\n---\n\n#### [Implement a binary search tree for fast lookups](book/content/part03/binary-search-tree.asc)\n\n- Learn how to add/remove/update values in a tree:\n![inserting node in a tree](book/images/image36.png)\n\n- [How to make a tree balanced?](book/B-self-balancing-binary-search-trees.asc)\n\nFrom unbalanced BST to balanced BST\n```\n1                           2\n  \\                       /   \\\n   2        =\u003e           1     3\n    \\\n     3\n```\n\n\n---\n\n  \u003c/details\u003e\n\u003c/blockquote\u003e\n\n### ⚒ [Algorithmic Toolbox](book/part04-algorithmic-toolbox.asc)\n\n\u003c!-- - Never get stuck solving a problem with seven simple steps. --\u003e\n\u003c!-- - Master the most popular sorting algorithms (merge sort, quicksort, insertion sort, etc.) --\u003e\n\u003c!-- - Learn different approaches to solve problems such as divide and conquer, dynamic programming, greedy algorithms, and backtracking. --\u003e\n\n\u003cblockquote\u003e\n  \u003cdetails\u003e\n    \u003csummary\u003e\n      Never get stuck solving a problem with 7 simple steps. \u003ci\u003e(Click to expand)\u003c/i\u003e\n    \u003c/summary\u003e\n\n---\n\n#### [Never get stuck solving a problem with 8 simple steps](book/part04-algorithmic-toolbox.asc)\n\n1. Understand the problem\n1. Build a simple example (no edge cases yet)\n1. Brainstorm solutions (greedy algorithm, Divide and Conquer, Backtracking, brute force)\n1. Test your answer on the simple example (mentally)\n1. Optimize the solution\n1. Write code. Yes, now you can code.\n1. Test your written code\n1. Analyse the complexity, both space and time, and make sure to optimize further.\n\nFull details [here](book/part04-algorithmic-toolbox.asc)\n\n---\n\n  \u003c/details\u003e\n  \u003cdetails\u003e\n    \u003csummary\u003e\n      Master the most popular sorting algorithms (merge sort, quicksort, etc.) \u003ci\u003e(Click to expand)\u003c/i\u003e\n    \u003c/summary\u003e\n\n---\n\n#### [Master the most popular sorting algorithms](book/content/part04/sorting-algorithms.asc)\n\nWe are going to explore three essential sorting algorithms O(n^2), which have low overhead:\n  - Bubble Sort.\n    [Code](src/algorithms/sorting/bubble-sort.js)\n    |\n    [Docs](book/content/part04/bubble-sort.asc)\n\n  - Insertion Sort.\n    [Code](src/algorithms/sorting/insertion-sort.js)\n    |\n    [Docs](book/content/part04/insertion-sort.asc)\n\n  - Selection Sort.\n    [Code](src/algorithms/sorting/selection-sort.js)\n    |\n    [Docs](book/content/part04/selection-sort.asc)\n\nand then discuss efficient sorting algorithms O(n log n) such as:\n  - Merge Sort.\n    [Code](src/algorithms/sorting/merge-sort.js)\n    |\n    [Docs](book/content/part04/merge-sort.asc)\n\n  - Quicksort.\n    [Code](src/algorithms/sorting/quick-sort.js)\n    |\n    [Docs](book/content/part04/quick-sort.asc)\n\n---\n\n  \u003c/details\u003e\n  \u003cdetails\u003e\n    \u003csummary\u003e\n      Learn different approaches to solve problems such as divide and conquer, dynamic programming, greedy algorithms, and backtracking. \u003ci\u003e(Click to expand)\u003c/i\u003e\n    \u003c/summary\u003e\n\n---\n\n#### [Learn different approaches to solve algorithmic problems](book/part04-algorithmic-toolbox.asc)\n\nWe are going to discuss the following techniques for solving algorithms problems:\n- [Greedy Algorithms](book/content/part04/greedy-algorithms.asc): makes greedy choices using heuristics to find the best solution without looking back.\n- [Dynamic Programming](book/content/part04/dynamic-programming.asc): a technique for speeding up recursive algorithms when there are many _overlapping subproblems_. It uses _memoization_ to avoid duplicating work.\n- [Divide and Conquer](book/content/part04/divide-and-conquer.asc): _divide_ problems into smaller pieces, _conquer_ each subproblem, and then _join_ the results.\n- [Backtracking](book/content/part04/backtracking.asc): search _all (or some)_ possible paths. However, it stops, and _go back_ as soon as notice the current solution is not working.\n- _Brute Force_: generate all possible solutions and tries all of them. (Use it as a last resort or as the starting point).\n\n---\n\n  \u003c/details\u003e\n\u003c/blockquote\u003e\n\n## FAQ\n\n\u003cdetails\u003e\n    \u003csummary\u003eHow would I apply these to my day-to-day work? \u003ci\u003e(Click to expand)\u003c/i\u003e\u003c/summary\u003e\n    \u003cp\u003e\n    As a programmer, we have to solve problems every day. If you want to solve problems well, it's good to know about a broad range of solutions. Often, it's more efficient to learn existing resources than stumble upon the answer yourself. The more tools and practice you have, the better. This book helps you understand the tradeoffs among data structures and reason about algorithms performance.\n    \u003c/p\u003e\n\u003c/details\u003e\n\n\u003cdetails\u003e\n    \u003csummary\u003eWhy you created this repo/book?\u003c/summary\u003e\n    \u003cp\u003e\n        There are not many books about Algorithms in JavaScript. This material fills the gap.\n        Also, it's good practice :)\n    \u003c/p\u003e\n\u003c/details\u003e\n\n\u003cdetails\u003e\n    \u003csummary\u003eIs there anyone I can contact if I have questions about something in particular?\n    \u003c/summary\u003e\n    \u003cp\u003e\n    Yes, open an issue or ask questions on the [slack channel](https://dsajs-slackin.herokuapp.com).\n    \u003c/p\u003e\n\u003c/details\u003e\n\n## Book\n\nThis project is also available in a [book](https://books.adrianmejia.com/dsajs-data-structures-algorithms-javascript/). You will get a nicely formatted PDF with 180+ pages + ePub and Mobi version.\n\n[![dsa.js book](https://books.adrianmejia.com/dsajs-data-structures-algorithms-javascript/images/dsajs-cover-320h2.png)](https://books.adrianmejia.com/dsajs-data-structures-algorithms-javascript/)\n\n## Support\n\nReach out to me at one of the following places!\n\n- Twitter at \u003ca href=\"http://twitter.com/iAmAdrianMejia\" target=\"_blank\"\u003e`@iAmAdrianMejia`\u003c/a\u003e\n- Chat on \u003ca href=\"https://dsajs-slackin.herokuapp.com\" target=\"_blank\"\u003e`dsajs.slack.com`\u003c/a\u003e\n\n## License\n\n[![License](https://img.shields.io/:license-mit-blue.svg?style=flat-square)](LICENSE)\n\n\u003c!-- ![](https://data.uxeranalytics.com/image1.png?uxa=github-dsajs) --\u003e\n","funding_links":["https://github.com/sponsors/amejiarosario","https://patreon.com/amejiarosario","https://adrianmejia.com/support/"],"categories":["JavaScript","Don't forget to give a :star: to make the project popular","Understanding the Theory and the fundamentals of some super-popular Algorithm questions","Github"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famejiarosario%2Fdsa.js-data-structures-algorithms-javascript","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Famejiarosario%2Fdsa.js-data-structures-algorithms-javascript","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famejiarosario%2Fdsa.js-data-structures-algorithms-javascript/lists"}