Skip to content

docs(book): fix table typos #42

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 19, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Bug Fixes (patch)

## [1.3.9]

### Breaking Changes (major)

### New Features (minor)

### Bug Fixes (patch)
- fix(book): fix table typos [commit](https://github.com/amejiarosario/dsa.js/commit/bc51a7a0c97aea9dea1afa5f8af22c0bed1382d3)

## [1.3.8]

### Breaking Changes (major)
Expand Down Expand Up @@ -134,7 +143,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

-

[Unreleased]: https://github.com/amejiarosario/dsa.js/compare/1.3.8...HEAD
[Unreleased]: https://github.com/amejiarosario/dsa.js/compare/1.3.9...HEAD
[1.3.9]: https://github.com/amejiarosario/dsa.js/compare/1.3.8...1.3.9
[1.3.7]: https://github.com/amejiarosario/dsa.js/compare/1.3.7...1.3.8
[1.3.6]: https://github.com/amejiarosario/dsa.js/compare/1.3.6...1.3.7
[1.3.6]: https://github.com/amejiarosario/dsa.js/compare/1.3.5...1.3.6
Expand Down
8 changes: 4 additions & 4 deletions book/content/part02/array-vs-list-vs-queue-vs-stack.asc
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ In this part of the book, we explored the most used linear data structures such
.2+.^s| Data Structure 2+^s| Searching By 3+^s| Inserting at the 3+^s| Deleting from .2+.^s| Space
^|_Index/Key_ ^|_Value_ ^|_beginning_ ^|_middle_ ^|_end_ ^|_beginning_ ^|_middle_ ^|_end_
| <<part02-linear-data-structures#array>> ^|O(1) ^|O(n) ^|O(n) ^|O(n) ^|O(1) ^|O(n) ^|O(n) ^|O(1) ^|O(n)
| <<part02-linear-data-structures#singly-linked-list>> ^|O(n) ^|O(n) ^|O(1) ^|O(n) ^|O(1) ^|O(1) ^|O(n) ^|*O(n)* ^|O(n)
| <<part02-linear-data-structures#doubly-linked-list>> ^|O(n) ^|O(n) ^|O(1) ^|O(n) ^|O(1) ^|O(1) ^|O(n) ^|*O(1)* ^|O(n)
| <<part02-linear-data-structures#singly-linked-list>> ^|O(n) ^|O(n) ^|O(1) ^|O(n) ^|*O(n)* ^|O(1) ^|O(n) ^|*O(n)* ^|O(n)
| <<part02-linear-data-structures#doubly-linked-list>> ^|O(n) ^|O(n) ^|O(1) ^|O(n) ^|*O(1)* ^|O(1) ^|O(n) ^|*O(1)* ^|O(n)
| <<part02-linear-data-structures#stack>> ^|- ^|- ^|- ^|- ^|O(1) ^|- ^|- ^|O(1) ^|O(n)
| Queue (w/array) ^|- ^|- ^|- ^|- ^|*O(n)* ^|- ^|- ^|O(1) ^|O(n)
| <<part02-linear-data-structures#queue>> (w/list) ^|- ^|- ^|- ^|- ^|O(1) ^|- ^|- ^|O(1) ^|O(n)
| Queue (w/array) ^|- ^|- ^|- ^|- ^|O(1) ^|*O(n)* ^|- ^|- ^|O(n)
| <<part02-linear-data-structures#queue>> (w/list) ^|- ^|- ^|- ^|- ^|O(1) ^|*O(1)* ^|- ^|- ^|O(n)
|===
// end::table[]
2 changes: 1 addition & 1 deletion book/content/part04/backtracking.asc
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ endif::backend-pdf[]

Listing all possible solutions might sound like a brute force.
However, it is not the same.
Backtracking algorithms are faster than brute force one.
Backtracking algorithms are faster because it test if a path will lead to a solution or not.

.Brute Force vs. Backtracking Algorithms
****
Expand Down
28 changes: 28 additions & 0 deletions lab/exercises/09-backtracking/generate-parentheses.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/**
* https://leetcode.com/submissions/detail/313704254/
* @param {number} n
* @return {string[]}
*/
function generateParenthesis(n, result = [], open = 0, close = 0, curr = '') {
if (curr.length === n * 2) {
result.push(curr);
} else {
if (open < n) {
generateParenthesis(n, result, open + 1, close, `${curr}(`);
}
if (close < n) {
generateParenthesis(n, result, open, close + 1, `${curr})`);
}
}

return result;
}

module.exports = generateParenthesis;

/*
0: [""]
1: ["()"]
2: ["(())", "()()"]
3: ["((()))", "()()()", "(())()", "()(())"]
*/
27 changes: 27 additions & 0 deletions lab/exercises/09-backtracking/generate-parentheses.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
const generateParenthesis = require('./generate-parentheses');

describe('Generate Parenthesis', () => {
it('should work with 0', () => {
expect(generateParenthesis(1)).toEqual(expect.arrayContaining([
]));
});

it('should work with 1', () => {
expect(generateParenthesis(1)).toEqual(expect.arrayContaining([
'()',
]));
});

it('should work with 2', () => {
expect(generateParenthesis(2)).toEqual(expect.arrayContaining([
'(())',
'()()',
]));
});

it('should work with 3', () => {
expect(generateParenthesis(3)).toEqual(expect.arrayContaining(
['((()))', '(()())', '(())()', '()(())', '()()()'],
));
});
});
1 change: 1 addition & 0 deletions lab/exercises/09-backtracking/powerset-backtrack.js
7 changes: 3 additions & 4 deletions notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ git log <last tag> HEAD --pretty=format:%s
# example
git log 1.1.0..HEAD --pretty=format:%s

git log 1.3.6..HEAD --pretty=format:"- %s [commit](https://github.com/amejiarosario/dsa.js/commit/%H)" --grep "BREAKING CHANGE:"
git log 1.3.6..HEAD --pretty=format:"- %s [commit](https://github.com/amejiarosario/dsa.js/commit/%H)" --grep "^feat.*:"
git log 1.3.6..HEAD --pretty=format:"- %s [commit](https://github.com/amejiarosario/dsa.js/commit/%H)" --grep "^fix.*:"
git log 1.3.8..HEAD --pretty=format:"- %s [commit](https://github.com/amejiarosario/dsa.js/commit/%H)" --grep "BREAKING CHANGE:"
git log 1.3.8..HEAD --pretty=format:"- %s [commit](https://github.com/amejiarosario/dsa.js/commit/%H)" --grep "^feat.*:"
git log 1.3.8..HEAD --pretty=format:"- %s [commit](https://github.com/amejiarosario/dsa.js/commit/%H)" --grep "^fix.*:"
```

New features in this release
Expand Down Expand Up @@ -117,4 +117,3 @@ alert('foo');
console.log('bar');
/* eslint-enable no-alert */
```

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "dsa.js",
"version": "1.3.8",
"version": "1.3.9",
"description": "Data Structures & Algorithms in JS",
"author": "Adrian Mejia <hi+dsajs@adrianmejia.com> (https://adrianmejia.com)",
"homepage": "https://github.com/amejiarosario/dsa.js",
Expand Down