Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: VitorEmanuelDev/javascript-datastructures-algorithms
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: c1c374f
Choose a base ref
...
head repository: loiane/javascript-datastructures-algorithms
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 656b6e9
Choose a head ref

Commits on Apr 1, 2019

  1. Update README.md

    typo
    ayomel authored Apr 1, 2019
    Copy the full SHA
    f64d9d8 View commit details

Commits on May 8, 2019

  1. grammar correction

    shockyng committed May 8, 2019
    Copy the full SHA
    0e0ba57 View commit details

Commits on Oct 29, 2019

  1. Bump mixin-deep from 1.3.1 to 1.3.2

    Bumps [mixin-deep](https://github.com/jonschlinkert/mixin-deep) from 1.3.1 to 1.3.2.
    - [Release notes](https://github.com/jonschlinkert/mixin-deep/releases)
    - [Commits](jonschlinkert/mixin-deep@1.3.1...1.3.2)
    
    Signed-off-by: dependabot[bot] <support@github.com>
    dependabot[bot] authored Oct 29, 2019
    Copy the full SHA
    01e35d4 View commit details

Commits on Mar 13, 2020

  1. Bump acorn from 6.1.1 to 6.4.1

    Bumps [acorn](https://github.com/acornjs/acorn) from 6.1.1 to 6.4.1.
    - [Release notes](https://github.com/acornjs/acorn/releases)
    - [Commits](acornjs/acorn@6.1.1...6.4.1)
    
    Signed-off-by: dependabot[bot] <support@github.com>
    dependabot[bot] authored Mar 13, 2020
    Copy the full SHA
    3236269 View commit details

Commits on Apr 16, 2020

  1. Bump https-proxy-agent from 2.2.1 to 2.2.4

    Bumps [https-proxy-agent](https://github.com/TooTallNate/node-https-proxy-agent) from 2.2.1 to 2.2.4.
    - [Release notes](https://github.com/TooTallNate/node-https-proxy-agent/releases)
    - [Commits](TooTallNate/proxy-agents@2.2.1...2.2.4)
    
    Signed-off-by: dependabot[bot] <support@github.com>
    dependabot[bot] authored Apr 16, 2020
    Copy the full SHA
    0a606fd View commit details

Commits on Jul 16, 2020

  1. Bump lodash from 4.17.10 to 4.17.19

    Bumps [lodash](https://github.com/lodash/lodash) from 4.17.10 to 4.17.19.
    - [Release notes](https://github.com/lodash/lodash/releases)
    - [Commits](lodash/lodash@4.17.10...4.17.19)
    
    Signed-off-by: dependabot[bot] <support@github.com>
    dependabot[bot] authored Jul 16, 2020
    Copy the full SHA
    ae6c563 View commit details

Commits on Jul 19, 2020

  1. Merge pull request loiane#134 from LuanHenriqueR8/master

    grammar correction
    loiane authored Jul 19, 2020
    Copy the full SHA
    2acc2db View commit details
  2. Merge pull request loiane#156 from loiane/dependabot/npm_and_yarn/lod…

    …ash-4.17.19
    
    Bump lodash from 4.17.10 to 4.17.19
    loiane authored Jul 19, 2020
    Copy the full SHA
    1bce038 View commit details
  3. Merge pull request loiane#155 from loiane/dependabot/npm_and_yarn/htt…

    …ps-proxy-agent-2.2.4
    
    Bump https-proxy-agent from 2.2.1 to 2.2.4
    loiane authored Jul 19, 2020
    Copy the full SHA
    10df6bc View commit details
  4. Bump eslint-utils from 1.3.1 to 1.4.3

    Bumps [eslint-utils](https://github.com/mysticatea/eslint-utils) from 1.3.1 to 1.4.3.
    - [Release notes](https://github.com/mysticatea/eslint-utils/releases)
    - [Commits](mysticatea/eslint-utils@v1.3.1...v1.4.3)
    
    Signed-off-by: dependabot[bot] <support@github.com>
    dependabot[bot] authored Jul 19, 2020
    Copy the full SHA
    a23fcdb View commit details
  5. Bump codecov from 3.2.0 to 3.6.5

    Bumps [codecov](https://github.com/codecov/codecov-node) from 3.2.0 to 3.6.5.
    - [Release notes](https://github.com/codecov/codecov-node/releases)
    - [Commits](https://github.com/codecov/codecov-node/commits)
    
    Signed-off-by: dependabot[bot] <support@github.com>
    dependabot[bot] authored Jul 19, 2020
    Copy the full SHA
    25be7be View commit details
  6. Copy the full SHA
    d326a23 View commit details
  7. Copy the full SHA
    b7656b8 View commit details
  8. Merge pull request loiane#126 from mhunter11/patch-1

    Update README.md
    loiane authored Jul 19, 2020
    Copy the full SHA
    0e2c40f View commit details
  9. Merge pull request loiane#149 from loiane/dependabot/npm_and_yarn/mix…

    …in-deep-1.3.2
    
    Bump mixin-deep from 1.3.1 to 1.3.2
    loiane authored Jul 19, 2020
    Copy the full SHA
    6021ccd View commit details
  10. Merge pull request loiane#153 from loiane/dependabot/npm_and_yarn/aco…

    …rn-6.4.1
    
    Bump acorn from 6.1.1 to 6.4.1
    loiane authored Jul 19, 2020
    Copy the full SHA
    98a6f52 View commit details
  11. Merge pull request loiane#158 from loiane/dependabot/npm_and_yarn/han…

    …dlebars-4.7.6
    
    Bump handlebars from 4.0.10 to 4.7.6
    loiane authored Jul 19, 2020
    Copy the full SHA
    169f5de View commit details
  12. Merge pull request loiane#157 from loiane/dependabot/npm_and_yarn/esl…

    …int-utils-1.4.3
    
    Bump eslint-utils from 1.3.1 to 1.4.3
    loiane authored Jul 19, 2020
    Copy the full SHA
    a3e72d8 View commit details
  13. Merge pull request loiane#152 from loiane/dependabot/npm_and_yarn/cod…

    …ecov-3.6.5
    
    Bump codecov from 3.2.0 to 3.6.5
    loiane authored Jul 19, 2020
    Copy the full SHA
    6bda9e6 View commit details
  14. Bump fstream from 1.0.11 to 1.0.12

    Bumps [fstream](https://github.com/npm/fstream) from 1.0.11 to 1.0.12.
    - [Release notes](https://github.com/npm/fstream/releases)
    - [Commits](npm/fstream@v1.0.11...v1.0.12)
    
    Signed-off-by: dependabot[bot] <support@github.com>
    dependabot[bot] authored Jul 19, 2020
    Copy the full SHA
    a0d4200 View commit details
  15. Bump js-yaml from 3.10.0 to 3.13.1

    Bumps [js-yaml](https://github.com/nodeca/js-yaml) from 3.10.0 to 3.13.1.
    - [Release notes](https://github.com/nodeca/js-yaml/releases)
    - [Changelog](https://github.com/nodeca/js-yaml/blob/master/CHANGELOG.md)
    - [Commits](nodeca/js-yaml@3.10.0...3.13.1)
    
    Signed-off-by: dependabot[bot] <support@github.com>
    dependabot[bot] authored Jul 19, 2020
    Copy the full SHA
    22eb236 View commit details

Commits on Jul 21, 2020

  1. Bump codecov from 3.6.5 to 3.7.1

    Bumps [codecov](https://github.com/codecov/codecov-node) from 3.6.5 to 3.7.1.
    - [Release notes](https://github.com/codecov/codecov-node/releases)
    - [Commits](codecov/codecov-node@v3.6.5...v3.7.1)
    
    Signed-off-by: dependabot[bot] <support@github.com>
    dependabot[bot] authored Jul 21, 2020
    Copy the full SHA
    39ac473 View commit details

Commits on Jul 30, 2020

  1. Bump elliptic from 6.4.1 to 6.5.3

    Bumps [elliptic](https://github.com/indutny/elliptic) from 6.4.1 to 6.5.3.
    - [Release notes](https://github.com/indutny/elliptic/releases)
    - [Commits](indutny/elliptic@v6.4.1...v6.5.3)
    
    Signed-off-by: dependabot[bot] <support@github.com>
    dependabot[bot] authored Jul 30, 2020
    Copy the full SHA
    ebe7e38 View commit details
  2. Merge pull request loiane#160 from loiane/dependabot/npm_and_yarn/fst…

    …ream-1.0.12
    
    Bump fstream from 1.0.11 to 1.0.12
    loiane authored Jul 30, 2020
    Copy the full SHA
    4bedf17 View commit details
  3. Merge pull request loiane#161 from loiane/dependabot/npm_and_yarn/js-…

    …yaml-3.13.1
    
    Bump js-yaml from 3.10.0 to 3.13.1
    loiane authored Jul 30, 2020
    Copy the full SHA
    d077ff4 View commit details
  4. Merge pull request loiane#162 from loiane/dependabot/npm_and_yarn/cod…

    …ecov-3.7.1
    
    Bump codecov from 3.6.5 to 3.7.1
    loiane authored Jul 30, 2020
    Copy the full SHA
    a7cd4a3 View commit details
  5. Merge pull request loiane#163 from loiane/dependabot/npm_and_yarn/ell…

    …iptic-6.5.3
    
    Bump elliptic from 6.4.1 to 6.5.3
    loiane authored Jul 30, 2020
    Copy the full SHA
    8151ba0 View commit details

Commits on Nov 2, 2020

  1. restored chapter 10 examples

    Loiane Groner committed Nov 2, 2020
    Copy the full SHA
    ec96129 View commit details
  2. updated http-server

    Loiane Groner committed Nov 2, 2020
    Copy the full SHA
    814a24d View commit details
  3. updated yargs

    Loiane Groner committed Nov 2, 2020
    Copy the full SHA
    f979034 View commit details

Commits on Dec 10, 2020

  1. Bump ini from 1.3.5 to 1.3.7

    Bumps [ini](https://github.com/isaacs/ini) from 1.3.5 to 1.3.7.
    - [Release notes](https://github.com/isaacs/ini/releases)
    - [Commits](npm/ini@v1.3.5...v1.3.7)
    
    Signed-off-by: dependabot[bot] <support@github.com>
    dependabot[bot] authored Dec 10, 2020
    Copy the full SHA
    99bca3b View commit details

Commits on Jan 16, 2021

  1. Merge pull request loiane#166 from loiane/dependabot/npm_and_yarn/ini…

    …-1.3.7
    
    Bump ini from 1.3.5 to 1.3.7
    loiane authored Jan 16, 2021
    Copy the full SHA
    08b2f4a View commit details

Commits on Apr 19, 2021

  1. Bump ssri from 6.0.1 to 6.0.2

    Bumps [ssri](https://github.com/npm/ssri) from 6.0.1 to 6.0.2.
    - [Release notes](https://github.com/npm/ssri/releases)
    - [Changelog](https://github.com/npm/ssri/blob/v6.0.2/CHANGELOG.md)
    - [Commits](npm/ssri@v6.0.1...v6.0.2)
    
    Signed-off-by: dependabot[bot] <support@github.com>
    dependabot[bot] authored Apr 19, 2021
    Copy the full SHA
    6f1d371 View commit details

Commits on May 6, 2021

  1. Copy the full SHA
    2b8810c View commit details

Commits on May 7, 2021

  1. Bump lodash from 4.17.10 to 4.17.21

    Bumps [lodash](https://github.com/lodash/lodash) from 4.17.10 to 4.17.21.
    - [Release notes](https://github.com/lodash/lodash/releases)
    - [Commits](lodash/lodash@4.17.10...4.17.21)
    
    Signed-off-by: dependabot[bot] <support@github.com>
    dependabot[bot] authored May 7, 2021
    Copy the full SHA
    f66914c View commit details

Commits on May 9, 2021

  1. Bump hosted-git-info from 2.6.0 to 2.8.9

    Bumps [hosted-git-info](https://github.com/npm/hosted-git-info) from 2.6.0 to 2.8.9.
    - [Release notes](https://github.com/npm/hosted-git-info/releases)
    - [Changelog](https://github.com/npm/hosted-git-info/blob/v2.8.9/CHANGELOG.md)
    - [Commits](npm/hosted-git-info@v2.6.0...v2.8.9)
    
    Signed-off-by: dependabot[bot] <support@github.com>
    dependabot[bot] authored May 9, 2021
    Copy the full SHA
    b2dffee View commit details

Commits on May 24, 2021

  1. Merge pull request loiane#174 from loiane/dependabot/npm_and_yarn/hos…

    …ted-git-info-2.8.9
    
    Bump hosted-git-info from 2.6.0 to 2.8.9
    loiane authored May 24, 2021
    Copy the full SHA
    fecf5ca View commit details
  2. Merge pull request loiane#173 from loiane/dependabot/npm_and_yarn/lod…

    …ash-4.17.21
    
    Bump lodash from 4.17.10 to 4.17.21
    loiane authored May 24, 2021
    Copy the full SHA
    dfcc358 View commit details
  3. Merge pull request loiane#172 from loiane/dependabot/npm_and_yarn/han…

    …dlebars-4.7.7
    
    Bump handlebars from 4.0.11 to 4.7.7
    loiane authored May 24, 2021
    Copy the full SHA
    638e58f View commit details
  4. Merge pull request loiane#171 from loiane/dependabot/npm_and_yarn/ssr…

    …i-6.0.2
    
    Bump ssri from 6.0.1 to 6.0.2
    loiane authored May 24, 2021
    Copy the full SHA
    c4ea585 View commit details

Commits on Aug 4, 2021

  1. Merge pull request loiane#1 from loiane/main

    Update
    rookie-mr authored Aug 4, 2021
    Copy the full SHA
    21bf21a View commit details

Commits on Sep 25, 2021

  1. Merge pull request loiane#180 from rookie-mr/main

    Merge pull request loiane#1 from loiane/main
    loiane authored Sep 25, 2021
    Copy the full SHA
    db35403 View commit details

Commits on Oct 1, 2021

  1. Merge pull request loiane#182 from loiane/main

    Updated content
    loiane authored Oct 1, 2021
    Copy the full SHA
    656b6e9 View commit details
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -61,16 +61,16 @@ Source code of **Learning JavaScript Data Structures and Algorithms** book, thir
## Installing and running the book examples With Node

* Install [Node](https://nodejs.org)
* Open terminal/cmd and change directoty to this project folder: `cd /Users/.../javascript-datastructures-algorithms` (Linux/Max) or `cd C:/.../javascript-datastructures-algorithms`
* run `npm install` to install all depencies
* Open terminal/cmd and change directory to this project folder: `cd /Users/.../javascript-datastructures-algorithms` (Linux/Max) or `cd C:/.../javascript-datastructures-algorithms`
* run `npm install` to install all dependencies
* To see the examples, run `http-server html` or `npm run serve`. Open your browser `http:\\localhost:8080` to see the book examples
* Or `cd html/chapter01` and run each javascript file with node: `node 02-Variables`

## Running the examples in the browser

* Right click on the html file you would like to see the examples, right click and 'Open with Chrome (or any other browser)'

* Or open the `examples/index.html` file to easily nagivate through all examples:
* Or open the `examples/index.html` file to easily navigate through all examples:

* Demo: [https://javascript-ds-algorithms-book.firebaseapp.com](https://javascript-ds-algorithms-book.firebaseapp.com)

11 changes: 11 additions & 0 deletions examples/chapter10/01-UsingMinHeap.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<script src="./../PacktDataStructuresAlgorithms.min.js"></script>
<script src="01-UsingMinHeap.js"></script>
</body>
</html>
27 changes: 27 additions & 0 deletions examples/chapter10/01-UsingMinHeap.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
const { MinHeap } = PacktDataStructuresAlgorithms;

let heap = new MinHeap();

heap.insert(2);
heap.insert(3);
heap.insert(4);
heap.insert(5);

heap.insert(2);

console.log(heap.getAsArray());

console.log('Heap size: ', heap.size()); // 5
console.log('Heap is empty: ', heap.isEmpty()); // false
console.log('Heap min value: ', heap.findMinimum()); // 1

heap = new MinHeap();
for (let i = 1; i < 10; i++) {
heap.insert(i);
}

console.log(heap.getAsArray());

console.log('Extract minimum: ', heap.extract()); // 1
console.log(heap.getAsArray()); // [2, 4, 3, 8, 5, 6, 7, 9]

11 changes: 11 additions & 0 deletions examples/chapter10/02-UsingMaxHeap.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<script src="./../PacktDataStructuresAlgorithms.min.js"></script>
<script src="02-UsingMaxHeap.js"></script>
</body>
</html>
27 changes: 27 additions & 0 deletions examples/chapter10/02-UsingMaxHeap.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
const { MaxHeap } = PacktDataStructuresAlgorithms;

const maxHeap = new MaxHeap();

maxHeap.insert(2);
maxHeap.insert(3);
maxHeap.insert(4);
maxHeap.insert(5);

maxHeap.insert(1);

console.log(maxHeap.getAsArray());

console.log('Heap size: ', maxHeap.size()); // 5
console.log('Heap is empty: ', maxHeap.isEmpty()); // false
console.log('Heap min value: ', maxHeap.findMinimum()); // 5

maxHeap.insert(6);
maxHeap.insert(9);
maxHeap.insert(10);
maxHeap.insert(14);

console.log(maxHeap.getAsArray());

console.log('Extract minimum: ', maxHeap.extract());
console.log(maxHeap.getAsArray());

11 changes: 11 additions & 0 deletions examples/chapter10/03-HeapSort.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<script src="./../PacktDataStructuresAlgorithms.min.js"></script>
<script src="03-HeapSort.js"></script>
</body>
</html>
7 changes: 7 additions & 0 deletions examples/chapter10/03-HeapSort.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
const { heapSort } = PacktDataStructuresAlgorithms;

console.log('********** Heap Sort **********');
const array = [7, 6, 3, 5, 4, 1, 2];

console.log('Before sorting: ', array);
console.log('After sorting: ', heapSort(array));
17 changes: 10 additions & 7 deletions examples/index.html
Original file line number Diff line number Diff line change
@@ -194,15 +194,18 @@
</div>
</section>
<section class="mdl-layout__tab-panel" id="scroll-tab-10">
<div class="page-content">
<div class="page-content mdl-layout--fixed-drawer">
<div class="mdl-layout__drawer is-visible">
<nav class="mdl-navigation">
</nav>
</div>
<div class="page-content">
<div class="page-content mdl-layout--fixed-drawer">
<div class="mdl-layout__drawer is-visible">
<nav class="mdl-navigation">
<a class="mdl-navigation__link" href="chapter10/01-UsingMinHeap.html">01-UsingMinHeap</a>
<a class="mdl-navigation__link" href="chapter10/02-UsingMaxHeap.html">02-UsingMaxHeap</a>
<a class="mdl-navigation__link" href="chapter10/03-HeapSort.html">03-HeapSort</a>
</nav>
</div>
</div>
</section>
</div>
</section>
<section class="mdl-layout__tab-panel" id="scroll-tab-11">
<div class="page-content">
<div class="page-content mdl-layout--fixed-drawer">
Loading