11# Data Structures and Algorithms in JavaScript
2+
23[ ![ Build Status] ( https://travis-ci.com/amejiarosario/dsa.js.svg?branch=master )] ( https://travis-ci.com/amejiarosario/dsa.js )
4+ [ ![ npm version] ( https://badge.fury.io/js/dsa.js.svg )] ( https://badge.fury.io/js/dsa.js )
35
46This repository covers the implementation of the classical algorithms and data structures in JavaScript.
57
6- <!-- This goes along with [these posts series](https://adrianmejia.com/tags/tutorial-algorithms/) that explain each implementation in details and also this [book](https://gum.co/dsajs) that explain these topics and some with more examples and illustrations. -->
8+ ## Usage
9+
10+ You can clone the repo or install the code from NPM:
11+
12+ ``` sh
13+ npm install dsa.js
14+ ```
15+
16+ and then you can import it into your programs or CLI
17+
18+ ``` js
19+ const { LinkedList , Queue , Stack } = require (' dsa.js' );
20+ ```
21+
22+ For a full list of all the exposed data structures and algorithms [ see] ( https://github.com/amejiarosario/dsa.js/blob/master/src/index.js )
723
824## Book
925
10- You can check out the book that goes deeper into each topic and provide addtional illustrations and explanations.
26+ You can check out the book that goes deeper into each topic and provide additional illustrations and explanations.
1127
1228- Algorithmic toolbox to avoid getting stuck while coding.
1329- Explains data structures similarities and differences.
@@ -22,65 +38,67 @@ We are covering the following data structures.
2238[ ![ Interactive Data Structures] ( https://user-images.githubusercontent.com/418605/46118890-ba721180-c1d6-11e8-82bc-6a671428b422.png )] ( https://embed.kumu.io/85f1a4de5fb8430a10a1bf9c5118e015 )
2339
2440### Linear Data Structures
25- 1 . ** Arrays** : Built-in in most languages so not implemented here.
41+
42+ 1 . ** Arrays** : Built-in in most languages so not implemented here.
2643 [ Post] ( https://adrianmejia.com/blog/2018/04/28/data-structures-time-complexity-for-beginners-arrays-hashmaps-linked-lists-stacks-queues-tutorial/#Array ) .
2744
28- 2 . ** Linked Lists** : each data node has a link to the next (and
45+ 2 . ** Linked Lists** : each data node has a link to the next (and
2946 previous).
3047 [ Code] ( https://github.com/amejiarosario/dsa.js/blob/master/src/data-structures/linked-lists/linked-list.js )
3148 |
3249 [ Post] ( https://adrianmejia.com/blog/2018/04/28/data-structures-time-complexity-for-beginners-arrays-hashmaps-linked-lists-stacks-queues-tutorial/#Linked-Lists ) .
3350
34- 3 . ** Queue** : data flows in a "first-in, first-out" (FIFO) manner.
51+ 3 . ** Queue** : data flows in a "first-in, first-out" (FIFO) manner.
3552 [ Code] ( https://github.com/amejiarosario/dsa.js/blob/master/src/data-structures/queues/queue.js )
3653 |
3754 [ Post] ( https://adrianmejia.com/blog/2018/04/28/data-structures-time-complexity-for-beginners-arrays-hashmaps-linked-lists-stacks-queues-tutorial/#Queues )
3855
39- 4 . ** Stacks** : data flows in a "last-in, first-out" (LIFO) manner.
56+ 4 . ** Stacks** : data flows in a "last-in, first-out" (LIFO) manner.
4057 [ Code] ( https://github.com/amejiarosario/dsa.js/blob/master/src/data-structures/stacks/stack.js )
4158 |
4259 [ Post] ( https://adrianmejia.com/blog/2018/04/28/data-structures-time-complexity-for-beginners-arrays-hashmaps-linked-lists-stacks-queues-tutorial/#Stacks ) .
4360
4461### Non-Linear Data Structures
45- 1 . ** Trees** : data nodes has zero or more adjacent nodes a.k.a.
62+
63+ 1 . ** Trees** : data nodes has zero or more adjacent nodes a.k.a.
4664 children. Each node can only have one parent node otherwise is a
4765 graph not a tree.
4866 [ Code] ( https://github.com/amejiarosario/algorithms.js/tree/master/src/data-structures/trees )
4967 |
5068 [ Post] ( https://adrianmejia.com/blog/2018/06/11/data-structures-for-beginners-trees-binary-search-tree-tutorial/ )
5169
52- 1 . ** Binary Trees** : same as tree but only can have two children at
70+ 1 . ** Binary Trees** : same as tree but only can have two children at
5371 most.
5472 [ Code] ( https://github.com/amejiarosario/algorithms.js/tree/master/src/data-structures/trees )
5573 |
5674 [ Post] ( https://adrianmejia.com/blog/2018/06/11/data-structures-for-beginners-trees-binary-search-tree-tutorial/#Binary-Trees )
5775
58- 2 . ** Binary Search Trees** (BST): same as binary tree, but the
76+ 2 . ** Binary Search Trees** (BST): same as binary tree, but the
5977 nodes value keep this order ` left < parent < rigth ` .
6078 [ Code] ( https://github.com/amejiarosario/algorithms.js/blob/master/src/data-structures/trees/binary-search-tree.js )
6179 |
6280 [ Post] ( https://adrianmejia.com/blog/2018/06/11/data-structures-for-beginners-trees-binary-search-tree-tutorial/#Binary-Search-Tree-BST )
6381
64- 3 . ** AVL Trees** : Self-balanced BST to maximize look up time.
82+ 3 . ** AVL Trees** : Self-balanced BST to maximize look up time.
6583 [ Code] ( https://github.com/amejiarosario/algorithms.js/blob/master/src/data-structures/trees/avl-tree.js )
6684 |
6785 [ Post] ( https://adrianmejia.com/blog/2018/07/16/self-balanced-binary-search-trees-with-avl-tree-data-structure-for-beginners/ )
6886
69- 4 . ** Red-Black Trees** : Self-balanced BST more loose than AVL to
87+ 4 . ** Red-Black Trees** : Self-balanced BST more loose than AVL to
7088 maximize insertion speed.
7189 [ Code] ( https://github.com/amejiarosario/algorithms.js/blob/master/src/data-structures/trees/red-black-tree.js )
7290
73- 2 . ** Maps** : key-value store.
91+ 2 . ** Maps** : key-value store.
7492
75- 1 . ** Hash Maps** : implements map using a hash function.
93+ 1 . ** Hash Maps** : implements map using a hash function.
7694 [ Code] ( https://github.com/amejiarosario/algorithms.js/blob/master/src/data-structures/hash-maps/hashmap.js )
7795 |
7896 [ Post] ( https://adrianmejia.com/blog/2018/04/28/data-structures-time-complexity-for-beginners-arrays-hashmaps-linked-lists-stacks-queues-tutorial/#HashMaps )
7997
80- 2 . ** Tree Maps** : implement map using a self-balanced BST.
98+ 2 . ** Tree Maps** : implement map using a self-balanced BST.
8199 [ Code] ( https://github.com/amejiarosario/dsa.js/blob/master/src/data-structures/maps/tree-maps/tree-map.js )
82100
83- 3 . ** Graphs** : data ** nodes** that can have a connection or ** edge** to
101+ 3 . ** Graphs** : data ** nodes** that can have a connection or ** edge** to
84102 zero or more adjacent nodes. Unlike trees, nodes can have multiple
85103 parents, loops.
86104 [ Code] ( https://github.com/amejiarosario/algorithms.js/blob/master/src/data-structures/graphs/graph.js )
@@ -89,39 +107,39 @@ We are covering the following data structures.
89107
90108## Algorithms
91109
92- - Sorting algorithms
110+ - Sorting algorithms
93111
94- - Bubble Sort.
95- [Code](https://github.com/amejiarosario/dsa.js/blob/master/src/algorithms/sorting/bubble-sort.js)
112+ - Bubble Sort.
113+ [ Code] ( https://github.com/amejiarosario/dsa.js/blob/master/src/algorithms/sorting/bubble-sort.js )
96114
97- - Insertion Sort.
98- [Code](https://github.com/amejiarosario/dsa.js/blob/master/src/algorithms/sorting/insertion-sort.js)
115+ - Insertion Sort.
116+ [ Code] ( https://github.com/amejiarosario/dsa.js/blob/master/src/algorithms/sorting/insertion-sort.js )
99117
100- - Selection Sort.
101- [Code](https://github.com/amejiarosario/dsa.js/blob/master/src/algorithms/sorting/selection-sort.js)
118+ - Selection Sort.
119+ [ Code] ( https://github.com/amejiarosario/dsa.js/blob/master/src/algorithms/sorting/selection-sort.js )
102120
103- - Merge Sort.
104- [Code](https://github.com/amejiarosario/dsa.js/blob/master/src/algorithms/sorting/merge-sort.js)
121+ - Merge Sort.
122+ [ Code] ( https://github.com/amejiarosario/dsa.js/blob/master/src/algorithms/sorting/merge-sort.js )
105123
106- - Quicksort .
107- [Code](https://github.com/amejiarosario/dsa.js/blob/master/src/algorithms/sorting/quick-sort.js)
124+ - Quick sort .
125+ [ Code] ( https://github.com/amejiarosario/dsa.js/blob/master/src/algorithms/sorting/quick-sort.js )
108126
109- - Greedy Algorithms
127+ - Greedy Algorithms
110128
111- - Fractional Knapsack Problem.
112- [ Code] ( https://github.com/amejiarosario/dsa.js/blob/master/src/algorithms/knapsack-fractional.js )
129+ - Fractional Knapsack Problem.
130+ [ Code] ( https://github.com/amejiarosario/dsa.js/blob/master/src/algorithms/knapsack-fractional.js )
113131
114- - Divide and Conquer
132+ - Divide and Conquer
115133
116- - Fibonacci Numbers.
117- [ Code] ( https://github.com/amejiarosario/dsa.js/blob/master/src/algorithms/fibonacci-recursive.js )
134+ - Fibonacci Numbers.
135+ [ Code] ( https://github.com/amejiarosario/dsa.js/blob/master/src/algorithms/fibonacci-recursive.js )
118136
119- - Dynamic Programming
137+ - Dynamic Programming
120138
121- - Fibonacci with memoization.
122- [ Code] ( https://github.com/amejiarosario/dsa.js/blob/master/src/algorithms/fibanacci-dynamic-programming.js )
139+ - Fibonacci with memoization.
140+ [ Code] ( https://github.com/amejiarosario/dsa.js/blob/master/src/algorithms/fibanacci-dynamic-programming.js )
123141
124- - Backtracking algorithms
142+ - Backtracking algorithms
125143
126- - Word permutations.
127- [ Code] ( https://github.com/amejiarosario/dsa.js/blob/master/src/algorithms/permutations-backtracking.js )
144+ - Word permutations.
145+ [ Code] ( https://github.com/amejiarosario/dsa.js/blob/master/src/algorithms/permutations-backtracking.js )
0 commit comments