Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit bbe69dd

Browse files
Merge pull request amejiarosario#42 from amejiarosario/fix-table
docs(book): fix table typos
2 parents 382872f + 2521d1e commit bbe69dd

File tree

8 files changed

+76
-11
lines changed

8 files changed

+76
-11
lines changed

‎CHANGELOG.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1313

1414
### Bug Fixes (patch)
1515

16+
## [1.3.9]
17+
18+
### Breaking Changes (major)
19+
20+
### New Features (minor)
21+
22+
### Bug Fixes (patch)
23+
- fix(book): fix table typos [commit](https://github.com/amejiarosario/dsa.js/commit/bc51a7a0c97aea9dea1afa5f8af22c0bed1382d3)
24+
1625
## [1.3.8]
1726

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

135144
-
136145

137-
[Unreleased]: https://github.com/amejiarosario/dsa.js/compare/1.3.8...HEAD
146+
[Unreleased]: https://github.com/amejiarosario/dsa.js/compare/1.3.9...HEAD
147+
[1.3.9]: https://github.com/amejiarosario/dsa.js/compare/1.3.8...1.3.9
138148
[1.3.7]: https://github.com/amejiarosario/dsa.js/compare/1.3.7...1.3.8
139149
[1.3.6]: https://github.com/amejiarosario/dsa.js/compare/1.3.6...1.3.7
140150
[1.3.6]: https://github.com/amejiarosario/dsa.js/compare/1.3.5...1.3.6

‎book/content/part02/array-vs-list-vs-queue-vs-stack.asc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,10 @@ In this part of the book, we explored the most used linear data structures such
3232
.2+.^s| Data Structure 2+^s| Searching By 3+^s| Inserting at the 3+^s| Deleting from .2+.^s| Space
3333
^|_Index/Key_ ^|_Value_ ^|_beginning_ ^|_middle_ ^|_end_ ^|_beginning_ ^|_middle_ ^|_end_
3434
| <<part02-linear-data-structures#array>> ^|O(1) ^|O(n) ^|O(n) ^|O(n) ^|O(1) ^|O(n) ^|O(n) ^|O(1) ^|O(n)
35-
| <<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)
36-
| <<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)
35+
| <<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)
36+
| <<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)
3737
| <<part02-linear-data-structures#stack>> ^|- ^|- ^|- ^|- ^|O(1) ^|- ^|- ^|O(1) ^|O(n)
38-
| Queue (w/array) ^|- ^|- ^|- ^|- ^|*O(n)* ^|- ^|- ^|O(1) ^|O(n)
39-
| <<part02-linear-data-structures#queue>> (w/list) ^|- ^|- ^|- ^|- ^|O(1) ^|- ^|- ^|O(1) ^|O(n)
38+
| Queue (w/array) ^|- ^|- ^|- ^|- ^|O(1) ^|*O(n)* ^|- ^|- ^|O(n)
39+
| <<part02-linear-data-structures#queue>> (w/list) ^|- ^|- ^|- ^|- ^|O(1) ^|*O(1)* ^|- ^|- ^|O(n)
4040
|===
4141
// end::table[]

‎book/content/part04/backtracking.asc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ endif::backend-pdf[]
2020

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

2525
.Brute Force vs. Backtracking Algorithms
2626
****
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
/**
2+
* https://leetcode.com/submissions/detail/313704254/
3+
* @param {number} n
4+
* @return {string[]}
5+
*/
6+
function generateParenthesis(n, result = [], open = 0, close = 0, curr = '') {
7+
if (curr.length === n * 2) {
8+
result.push(curr);
9+
} else {
10+
if (open < n) {
11+
generateParenthesis(n, result, open + 1, close, `${curr}(`);
12+
}
13+
if (close < n) {
14+
generateParenthesis(n, result, open, close + 1, `${curr})`);
15+
}
16+
}
17+
18+
return result;
19+
}
20+
21+
module.exports = generateParenthesis;
22+
23+
/*
24+
0: [""]
25+
1: ["()"]
26+
2: ["(())", "()()"]
27+
3: ["((()))", "()()()", "(())()", "()(())"]
28+
*/
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
const generateParenthesis = require('./generate-parentheses');
2+
3+
describe('Generate Parenthesis', () => {
4+
it('should work with 0', () => {
5+
expect(generateParenthesis(1)).toEqual(expect.arrayContaining([
6+
]));
7+
});
8+
9+
it('should work with 1', () => {
10+
expect(generateParenthesis(1)).toEqual(expect.arrayContaining([
11+
'()',
12+
]));
13+
});
14+
15+
it('should work with 2', () => {
16+
expect(generateParenthesis(2)).toEqual(expect.arrayContaining([
17+
'(())',
18+
'()()',
19+
]));
20+
});
21+
22+
it('should work with 3', () => {
23+
expect(generateParenthesis(3)).toEqual(expect.arrayContaining(
24+
['((()))', '(()())', '(())()', '()(())', '()()()'],
25+
));
26+
});
27+
});
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../01-arrays/powerset/powerset-backtrack.js

‎notes.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ git log <last tag> HEAD --pretty=format:%s
2222
# example
2323
git log 1.1.0..HEAD --pretty=format:%s
2424

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

3030
New features in this release
@@ -117,4 +117,3 @@ alert('foo');
117117
console.log('bar');
118118
/* eslint-enable no-alert */
119119
```
120-

‎package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "dsa.js",
3-
"version": "1.3.8",
3+
"version": "1.3.9",
44
"description": "Data Structures & Algorithms in JS",
55
"author": "Adrian Mejia <hi+dsajs@adrianmejia.com> (https://adrianmejia.com)",
66
"homepage": "https://github.com/amejiarosario/dsa.js",

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /