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: mrfrigerio/javascript-datastructures-algorithms
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: main
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: main
Choose a head ref
Able to merge. These branches can be automatically merged.
Loading
40 changes: 40 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Handle line endings automatically for files detected as text
# and leave all files detected as binary untouched.
* text=auto

#
# The above will handle all files NOT found below
#
# These files are text and should be normalized (Convert crlf => lf)
*.css eol=lf
*.df eol=lf
*.htm eol=lf
*.html eol=lf
*.java eol=lf
*.js eol=lf
*.json eol=lf
*.jsp eol=lf
*.jspf eol=lf
*.jspx eol=lf
*.properties eol=lf
*.sh eol=lf
*.tld eol=lf
*.txt eol=lf
*.tag eol=lf
*.tagx eol=lf
*.xml eol=lf
*.yml eol=lf

# These files are binary and should be left untouched
# (binary is a macro for -text -diff)
*.class binary
*.dll binary
*.ear binary
*.gif binary
*.ico binary
*.jar binary
*.jpg binary
*.jpeg binary
*.png binary
*.so binary
*.war binary
27 changes: 27 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs

name: Node.js CI

on:
push:
branches: [ "fourth-edition" ]
pull_request:
branches: [ "fourth-edition" ]

jobs:
build:

runs-on: ubuntu-latest

strategy:
matrix:
node-version: [20.x, 22.x]
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- run: npm test
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -98,7 +98,7 @@ Book link - second edition:
- [Brazilian Portuguese version](https://novatec.com.br/livros/estruturas-de-dados-algoritmos-em-javascript/)

Book link - third edition:
- [Packt](https://www.packtpub.com/web-development/learning-javascript-data-structures-and-algorithms-third-edition)
- [Packt](https://www.packtpub.com/en-us/product/learning-javascript-data-structures-and-algorithms-9781788624947)
- [Amazon](http://a.co/cbMlYmJ)
- [Chinese version](http://www.ituring.com.cn/book/2653)
- [Brazilian Portuguese version](https://novatec.com.br/livros/estruturas-de-dados-algoritmos-em-javascript-2ed/)
2 changes: 1 addition & 1 deletion examples/chapter01_02/04-TruthyFalsy.js
Original file line number Diff line number Diff line change
@@ -24,4 +24,4 @@ testTruthy({}); // true (object is always true)
var obj = { name: 'John' };
testTruthy(obj); // true
testTruthy(obj.name); // true
testTruthy(obj.age); // age (property does not exist)
testTruthy(obj.age); // false (property age does not exist)
2 changes: 1 addition & 1 deletion examples/chapter09/04-Fibonacci.js
Original file line number Diff line number Diff line change
@@ -30,7 +30,7 @@ function fibonacciMemoization(n) {
const memo = [0, 1];
const fibonacci = (n) => {
if (memo[n] != null) return memo[n];
return memo[n] = fibonacci(n - 1, memo) + fibonacci(n - 2, memo);
return memo[n] = fibonacci(n - 1) + fibonacci(n - 2);
};
return fibonacci(n);
}
Loading