11# Data Structures and Algorithms in JavaScript
22
3+ [ ![ 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 )
5+
36This repository covers the implementation of the classical algorithms and data structures in JavaScript.
47
5- <!-- 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 ) .
623
724## Book
825
9- 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.
1027
1128- Algorithmic toolbox to avoid getting stuck while coding.
1229- Explains data structures similarities and differences.
@@ -21,65 +38,67 @@ We are covering the following data structures.
2138[ ![ Interactive Data Structures] ( https://user-images.githubusercontent.com/418605/46118890-ba721180-c1d6-11e8-82bc-6a671428b422.png )] ( https://embed.kumu.io/85f1a4de5fb8430a10a1bf9c5118e015 )
2239
2340### Linear Data Structures
24- 1 . ** Arrays** : Built-in in most languages so not implemented here.
41+
42+ 1 . ** Arrays** : Built-in in most languages so not implemented here.
2543 [ Post] ( https://adrianmejia.com/blog/2018/04/28/data-structures-time-complexity-for-beginners-arrays-hashmaps-linked-lists-stacks-queues-tutorial/#Array ) .
2644
27- 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
2846 previous).
2947 [ Code] ( https://github.com/amejiarosario/dsa.js/blob/master/src/data-structures/linked-lists/linked-list.js )
3048 |
3149 [ Post] ( https://adrianmejia.com/blog/2018/04/28/data-structures-time-complexity-for-beginners-arrays-hashmaps-linked-lists-stacks-queues-tutorial/#Linked-Lists ) .
3250
33- 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.
3452 [ Code] ( https://github.com/amejiarosario/dsa.js/blob/master/src/data-structures/queues/queue.js )
3553 |
3654 [ Post] ( https://adrianmejia.com/blog/2018/04/28/data-structures-time-complexity-for-beginners-arrays-hashmaps-linked-lists-stacks-queues-tutorial/#Queues )
3755
38- 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.
3957 [ Code] ( https://github.com/amejiarosario/dsa.js/blob/master/src/data-structures/stacks/stack.js )
4058 |
4159 [ Post] ( https://adrianmejia.com/blog/2018/04/28/data-structures-time-complexity-for-beginners-arrays-hashmaps-linked-lists-stacks-queues-tutorial/#Stacks ) .
4260
4361### Non-Linear Data Structures
44- 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.
4564 children. Each node can only have one parent node otherwise is a
4665 graph not a tree.
4766 [ Code] ( https://github.com/amejiarosario/algorithms.js/tree/master/src/data-structures/trees )
4867 |
4968 [ Post] ( https://adrianmejia.com/blog/2018/06/11/data-structures-for-beginners-trees-binary-search-tree-tutorial/ )
5069
51- 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
5271 most.
5372 [ Code] ( https://github.com/amejiarosario/algorithms.js/tree/master/src/data-structures/trees )
5473 |
5574 [ Post] ( https://adrianmejia.com/blog/2018/06/11/data-structures-for-beginners-trees-binary-search-tree-tutorial/#Binary-Trees )
5675
57- 2 . ** Binary Search Trees** (BST): same as binary tree, but the
76+ 2 . ** Binary Search Trees** (BST): same as binary tree, but the
5877 nodes value keep this order ` left < parent < rigth ` .
5978 [ Code] ( https://github.com/amejiarosario/algorithms.js/blob/master/src/data-structures/trees/binary-search-tree.js )
6079 |
6180 [ Post] ( https://adrianmejia.com/blog/2018/06/11/data-structures-for-beginners-trees-binary-search-tree-tutorial/#Binary-Search-Tree-BST )
6281
63- 3 . ** AVL Trees** : Self-balanced BST to maximize look up time.
82+ 3 . ** AVL Trees** : Self-balanced BST to maximize look up time.
6483 [ Code] ( https://github.com/amejiarosario/algorithms.js/blob/master/src/data-structures/trees/avl-tree.js )
6584 |
6685 [ Post] ( https://adrianmejia.com/blog/2018/07/16/self-balanced-binary-search-trees-with-avl-tree-data-structure-for-beginners/ )
6786
68- 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
6988 maximize insertion speed.
7089 [ Code] ( https://github.com/amejiarosario/algorithms.js/blob/master/src/data-structures/trees/red-black-tree.js )
7190
72- 2 . ** Maps** : key-value store.
91+ 2 . ** Maps** : key-value store.
7392
74- 1 . ** Hash Maps** : implements map using a hash function.
93+ 1 . ** Hash Maps** : implements map using a hash function.
7594 [ Code] ( https://github.com/amejiarosario/algorithms.js/blob/master/src/data-structures/hash-maps/hashmap.js )
7695 |
7796 [ Post] ( https://adrianmejia.com/blog/2018/04/28/data-structures-time-complexity-for-beginners-arrays-hashmaps-linked-lists-stacks-queues-tutorial/#HashMaps )
7897
79- 2 . ** Tree Maps** : implement map using a self-balanced BST.
98+ 2 . ** Tree Maps** : implement map using a self-balanced BST.
8099 [ Code] ( https://github.com/amejiarosario/dsa.js/blob/master/src/data-structures/maps/tree-maps/tree-map.js )
81100
82- 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
83102 zero or more adjacent nodes. Unlike trees, nodes can have multiple
84103 parents, loops.
85104 [ Code] ( https://github.com/amejiarosario/algorithms.js/blob/master/src/data-structures/graphs/graph.js )
@@ -88,39 +107,39 @@ We are covering the following data structures.
88107
89108## Algorithms
90109
91- - Sorting algorithms
110+ - Sorting algorithms
92111
93- - Bubble Sort.
94- [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 )
95114
96- - Insertion Sort.
97- [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 )
98117
99- - Selection Sort.
100- [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 )
101120
102- - Merge Sort.
103- [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 )
104123
105- - Quicksort .
106- [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 )
107126
108- - Greedy Algorithms
127+ - Greedy Algorithms
109128
110- - Fractional Knapsack Problem.
111- [ 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 )
112131
113- - Divide and Conquer
132+ - Divide and Conquer
114133
115- - Fibonacci Numbers.
116- [ 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 )
117136
118- - Dynamic Programming
137+ - Dynamic Programming
119138
120- - Fibonacci with memoization.
121- [ 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 )
122141
123- - Backtracking algorithms
142+ - Backtracking algorithms
124143
125- - Word permutations.
126- [ 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