Skip to content

[pull] master from amejiarosario:master #1

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

Open
wants to merge 251 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
251 commits
Select commit Hold shift + click to select a range
c1eda1d
Merge pull request #27 from monners/master
amejiarosario Aug 11, 2019
69afe33
change the stable properties
archanaserver Aug 16, 2019
3cb3cec
Merge pull request #28 from archanaserver/patch-1
amejiarosario Aug 16, 2019
98f0dfb
release: 1.3.4
amejiarosario Aug 16, 2019
b5aae35
fix typo
gerasimov Aug 19, 2019
3356e1f
Merge pull request #29 from gerasimov/patch-1
amejiarosario Aug 19, 2019
1fa9341
fix(tree-rotations): prevent losing nodes
amejiarosario Aug 23, 2019
ebb7be8
release: 1.3.5
amejiarosario Aug 23, 2019
72e3d68
style: fix eslint issue
amejiarosario Aug 23, 2019
d8ce2f5
update deps
amejiarosario Aug 23, 2019
8096f7c
release: 1.3.6
amejiarosario Aug 23, 2019
48fe6f3
Merge pull request #31 from amejiarosario/update-deps
amejiarosario Aug 23, 2019
98e2c03
fix(avl-tree): balance was not working properly
amejiarosario Aug 27, 2019
01ad65d
release: 1.3.7
amejiarosario Aug 27, 2019
22d0fb2
Merge pull request #34 from amejiarosario/beblueblue-question
amejiarosario Aug 27, 2019
2f202c1
fix yml file
amejiarosario Oct 15, 2019
c57cbfd
Update yaml file
amejiarosario Oct 17, 2019
06ef72a
Update README.md
bhagatapoorva Oct 31, 2019
8c0eca0
Merge pull request #36 from bhagatapoorva/master
amejiarosario Oct 31, 2019
f625d93
add examples
amejiarosario Nov 26, 2019
49d083b
fix lint errors
amejiarosario Nov 26, 2019
5628a27
Merge pull request #37 from amejiarosario/new-examples
amejiarosario Nov 26, 2019
ad15b5f
improve merge sort example
amejiarosario Jan 7, 2020
ac98583
fix(book): fix typo, array pop, and BST images
mdribera Feb 11, 2020
b9a41ba
Merge pull request #39 from mdribera/fix-typo-array-pop-and-bst-images
amejiarosario Feb 12, 2020
6f4585a
bump to 1.3.8
amejiarosario Feb 12, 2020
a53915f
fix(docs): fix typo for heaps
amejiarosario Feb 12, 2020
bb3ad9a
Merge pull request #40 from amejiarosario/version-bump
amejiarosario Feb 12, 2020
c7cb9fd
update twitter handler
amejiarosario Feb 12, 2020
6fbd551
docs: update twitter handler
amejiarosario Feb 12, 2020
bbfeb93
Merge pull request #41 from amejiarosario/fix-tw-handler
amejiarosario Feb 12, 2020
535afe6
subset/powerset problem
amejiarosario Mar 18, 2020
382872f
Merge branch 'master' of github.com:amejiarosario/dsa.js-data-structu…
amejiarosario Mar 18, 2020
bc51a7a
fix(book): fix table typos
amejiarosario Mar 19, 2020
2521d1e
docs: add new changelog and exercises
amejiarosario Mar 19, 2020
bbe69dd
Merge pull request #42 from amejiarosario/fix-table
amejiarosario Mar 19, 2020
a0e0fd8
feat(trie): implement trie data structure
amejiarosario Mar 22, 2020
524670e
simplify backtracking algorithm
amejiarosario Mar 22, 2020
19ff1f0
initial updates
Mar 23, 2020
9c36253
style(book): better wording for table
amejiarosario Mar 23, 2020
18b699e
bump version
amejiarosario Mar 23, 2020
a36179f
Merge pull request #45 from amejiarosario/v-tank/fix-suggestions
amejiarosario Mar 23, 2020
16005f3
feat(trie): remove method
amejiarosario Mar 22, 2020
eac045a
feat(linkedList): remove by node
amejiarosario Mar 27, 2020
3e787c6
feat(lru-cache): add new implementations
amejiarosario Mar 27, 2020
a81f6e1
feat(trie): remove method
amejiarosario Mar 22, 2020
e31cc62
feat(trie): feature complete
amejiarosario Mar 27, 2020
715cd95
build: add cz-changelog
amejiarosario Mar 29, 2020
e8c01e4
build(build): install husky and commitizen
amejiarosario Mar 29, 2020
efd4e29
:wrench: chore (build) Automate git commit messages
amejiarosario Mar 29, 2020
7da7a46
:wrench: chore (build) semantic release
amejiarosario Mar 29, 2020
03a420d
:wrench: chore (build):
amejiarosario Mar 29, 2020
fd8aa2e
:wrench: chore (ci): improve ci
amejiarosario Mar 30, 2020
696fc42
:wrench: chore (docs): simplify contributing
amejiarosario Mar 30, 2020
d671882
Merge pull request #46 from amejiarosario/feature/auto-changelog
amejiarosario Mar 30, 2020
9d25b28
:wrench: chore (ci): format tags
amejiarosario Mar 30, 2020
567c110
Merge pull request #47 from amejiarosario/automate-releases
amejiarosario Mar 30, 2020
965fbd1
Merge pull request #43 from amejiarosario/feature/trie
amejiarosario Mar 30, 2020
43041ad
:wrench: chore (build): automate changelog creation
amejiarosario Mar 30, 2020
93543c4
Merge pull request #48 from amejiarosario/automate-changelog-creation
amejiarosario Mar 30, 2020
e8ca8b7
Merge branch 'master' into feature/lru-cache
amejiarosario Mar 30, 2020
76854c6
Merge pull request #49 from amejiarosario/feature/lru-cache
amejiarosario Mar 30, 2020
bcc81b4
:bookmark: chore(release): 1.5.0
semantic-release-bot Mar 30, 2020
64a4a4f
chore(lab): add new exercises
amejiarosario May 6, 2020
874f3eb
:sparkles: feat (heap): Add Heap implementation (PriorityQueue) (#51)
amejiarosario May 8, 2020
a4b87e8
:wrench: chore (ci): adjust semantic-release (#52)
amejiarosario May 8, 2020
419fd11
chore(semantic-release): fix matchers
amejiarosario May 8, 2020
7279e5c
:wrench: chore (readme): update ci link
amejiarosario May 8, 2020
f4d0670
Merge pull request #53 from amejiarosario/chore/sematic-release
amejiarosario May 8, 2020
28da0e1
:bookmark: chore(release): 1.6.0
semantic-release-bot May 8, 2020
202ca9f
feat(heap): add min/max/median-heaps
amejiarosario May 16, 2020
1bb097d
chore(docs): add comments
amejiarosario May 16, 2020
7e19bdc
Merge branch 'master' into chore/sematic-release
amejiarosario May 16, 2020
517fec4
Merge pull request #54 from amejiarosario/chore/sematic-release
amejiarosario May 16, 2020
142c301
:bookmark: chore(release): 1.7.0
semantic-release-bot May 16, 2020
c253938
Better hash function
nuintun May 20, 2020
6974354
Merge pull request #56 from nuintun/patch-1
amejiarosario May 20, 2020
e13ff88
fix(hashmap): fix TextEncoder reference
amejiarosario May 20, 2020
a24c0d7
Merge pull request #57 from amejiarosario/hotfix/hashmap
amejiarosario May 20, 2020
8ea61ce
:bookmark: chore(release): 1.7.1
semantic-release-bot May 20, 2020
f6b47b5
fix(hashmap): improve methods documentation
amejiarosario May 23, 2020
924c9a7
feat(maps): implement clear method for hashMap and treeMap
amejiarosario May 23, 2020
2f24f57
fix(book/map): fix typo on maps space complexity
amejiarosario May 23, 2020
b5c7426
Merge pull request #58 from amejiarosario/feature/hashmap
amejiarosario May 23, 2020
7284619
:bookmark: chore(release): 1.8.0
semantic-release-bot May 23, 2020
3c4ef75
fix(book/maps): update time/space complexity values
amejiarosario May 24, 2020
0412eeb
Merge pull request #59 from amejiarosario/hotfix/hashmap
amejiarosario May 24, 2020
81c5f0d
:bookmark: chore(release): 1.8.1
semantic-release-bot May 24, 2020
0319b29
fix(book/hashset): update hashset space complexity
amejiarosario May 24, 2020
0344298
Merge pull request #61 from amejiarosario/hotfix/hashmap
amejiarosario May 24, 2020
aac8160
:bookmark: chore(release): 1.8.2
semantic-release-bot May 24, 2020
0be0176
fix(book/maps): update space complexity
amejiarosario May 24, 2020
63fd518
Merge pull request #62 from amejiarosario/hotfix/hashmap
amejiarosario May 24, 2020
f484075
:bookmark: chore(release): 1.8.3
semantic-release-bot May 24, 2020
288ff77
chore(book-quicksort): update time complexities
amejiarosario May 25, 2020
75f8d11
chore(benchmarks): new files for benchmarks
amejiarosario May 25, 2020
f3fe049
chore(book/sorting): fix bubble sort reference
amejiarosario May 25, 2020
9874647
Merge pull request #63 from amejiarosario/hotfix/sorting
amejiarosario May 26, 2020
1fa875f
feat(linkedList): takes iterables in the constructor
amejiarosario Jun 30, 2020
6af937f
feat(heap): remove by index
amejiarosario Jun 30, 2020
a93ac1b
chore(lab): add exercises
amejiarosario Jun 30, 2020
7e17577
Merge pull request #64 from amejiarosario/improvements
amejiarosario Jun 30, 2020
c7e5c31
:bookmark: chore(release): 1.9.0
semantic-release-bot Jun 30, 2020
3f99c56
chore(lab): add new exercises and fix comment:wq
amejiarosario Jul 9, 2020
8cabf9c
Merge pull request #65 from amejiarosario/new-exercises
amejiarosario Jul 10, 2020
bcaf819
feat(book/arrays): add exercises
amejiarosario Jul 28, 2020
6b33bc8
Merge pull request #66 from amejiarosario/feat/chapter-exercises
amejiarosario Jul 28, 2020
482bee0
:bookmark: chore(release): 1.10.0
semantic-release-bot Jul 28, 2020
cccadf8
chore: remove uxa
amejiarosario Aug 6, 2020
e5bd4b7
Merge branch 'master' of github.com:amejiarosario/dsa.js-data-structu…
amejiarosario Aug 19, 2020
3901188
chore(sorting): clean up variables
amejiarosario Aug 19, 2020
2fab838
add config test
amejiarosario Aug 20, 2020
4d75825
chore(jest): fix commands
amejiarosario Aug 20, 2020
b5a00dd
feat(book:array): add solutions for interview questions
amejiarosario Aug 20, 2020
996f7aa
chore(vscode): set colors
amejiarosario Aug 20, 2020
ca119f2
feat(book): add appendix D with interview question solutions
amejiarosario Aug 20, 2020
57960e2
fix(book): multiple broken links and bump epub version
amejiarosario Aug 21, 2020
5935b95
feat(book/array): add max subarray questions and solution
amejiarosario Aug 21, 2020
6ab8bc4
feat(book/array): add stock questions and solution
amejiarosario Aug 21, 2020
dbdef21
fix(book): workaround for c++ issue in asciidoc
amejiarosario Aug 22, 2020
9b356d9
Merge pull request #67 from amejiarosario/feat/add-exercises-solutions
amejiarosario Aug 22, 2020
e573929
:bookmark: chore(release): 1.11.0
semantic-release-bot Aug 22, 2020
f125511
chore(build): dockerfile
amejiarosario Aug 24, 2020
5466f28
Merge branch 'master' into chore/build-changes
amejiarosario Aug 24, 2020
738d6f3
chore(build): add Dockerfile
amejiarosario Aug 24, 2020
69f284d
chore(build): use jest config
amejiarosario Aug 24, 2020
db10bf7
chore(build): update ruby version
amejiarosario Aug 24, 2020
d3faa71
chore(build): remove deprecated dep
amejiarosario Aug 24, 2020
44fb6a2
Merge pull request #68 from amejiarosario/chore/build-changes
amejiarosario Aug 24, 2020
ca4bf45
feat(book/exercises): interview q&a for linked lists and stacks (#69)
amejiarosario Aug 26, 2020
06bd3f6
Revert "(book/exercises): interview q&a for linked lists and stacks (…
amejiarosario Aug 26, 2020
4cdfbf5
:bookmark: chore(release): 1.12.0
semantic-release-bot Aug 26, 2020
3bb86fd
feat(book/exercises): interview q&a for linked lists and stacks
amejiarosario Aug 26, 2020
3373f63
Merge pull request #71 from amejiarosario/revert-70-revert-69-feat/li…
amejiarosario Aug 26, 2020
263c9dc
:bookmark: chore(release): 1.13.0
semantic-release-bot Aug 26, 2020
04aa9db
feat(queue): add front, back and peek methods
amejiarosario Aug 28, 2020
9a88766
feat(book/queue): add solution for queue question
amejiarosario Aug 28, 2020
77d4596
feat(book/queue): add recent counter questions and solution
amejiarosario Aug 29, 2020
1f01baf
feat(book/questions): add where the interview questions have been seen
amejiarosario Aug 29, 2020
29b8dc8
chore(book): improve grammar
amejiarosario Aug 31, 2020
c1a8f8e
feat(book/questions): add examples
amejiarosario Aug 31, 2020
40d6b64
Merge pull request #72 from amejiarosario/feat/queue-interview-questions
amejiarosario Aug 31, 2020
e2f4af0
:bookmark: chore(release): 1.14.0
semantic-release-bot Aug 31, 2020
464417e
fix(book/solutions): fix missing solutions
amejiarosario Sep 1, 2020
068dd9c
feat(book/bt): add binary tree diameter problem
amejiarosario Sep 1, 2020
28346a4
feat(book/binary-tree): add right side view exercise and solution
amejiarosario Sep 2, 2020
bcb4c28
feat(BinaryTreeNode): add BinaryTreeNode.from
amejiarosario Sep 2, 2020
86201fb
chore(book/exercises): bst exercises after traversals
amejiarosario Sep 2, 2020
d07458d
Merge pull request #73 from amejiarosario/feat/tree-problems
amejiarosario Sep 2, 2020
1bfe522
:bookmark: chore(release): 1.15.0
semantic-release-bot Sep 2, 2020
d18186b
feat(book/hashmap): add exercises and solutions
amejiarosario Sep 3, 2020
2def4dc
Merge pull request #74 from amejiarosario/feat/hashmap-exercises
amejiarosario Sep 3, 2020
641b338
:bookmark: chore(release): 1.16.0
semantic-release-bot Sep 3, 2020
f40dc63
feat(book/set): add questions and solutions
amejiarosario Sep 4, 2020
75aa67a
chore(book/questions): improve function documentation
amejiarosario Sep 4, 2020
802e9d3
Merge pull request #75 from amejiarosario/feat/set-questions
amejiarosario Sep 4, 2020
8a92ba0
:bookmark: chore(release): 1.17.0
semantic-release-bot Sep 4, 2020
6a83cf8
feat(book/graph): add schedule exercise and solution
amejiarosario Sep 5, 2020
6b0e671
Merge pull request #76 from amejiarosario/feat/graph-questions
amejiarosario Sep 7, 2020
f248e42
:bookmark: chore(release): 1.18.0
semantic-release-bot Sep 7, 2020
3a2a24f
feat(book/pq): add exercise with pq and dijkstra
amejiarosario Sep 8, 2020
827177f
feat(heap): add error handling for heaps
amejiarosario Sep 8, 2020
edf8808
feat(pq): improves docs and usability of priority queues
amejiarosario Sep 8, 2020
c211644
Merge pull request #78 from amejiarosario/feat/priority-queue-exercise-2
amejiarosario Sep 8, 2020
65e302b
:bookmark: chore(release): 2.0.0
semantic-release-bot Sep 8, 2020
fdb8bd8
feat(book/sorting): add questions and solutions
amejiarosario Sep 11, 2020
cba73a1
update kindlegen
amejiarosario Sep 11, 2020
56e8823
Merge pull request #79 from amejiarosario/feat/sorting-questions
amejiarosario Sep 11, 2020
57b6eb9
:bookmark: chore(release): 2.1.0
semantic-release-bot Sep 11, 2020
b956708
chore(book): improves grammar
amejiarosario Sep 11, 2020
06d75d8
Merge pull request #80 from amejiarosario/feat/sorting-questions
amejiarosario Sep 12, 2020
69fa96b
chore: new exercise
amejiarosario Sep 22, 2020
2e77826
chore: placeholder for exercises
amejiarosario Sep 27, 2020
68c73d4
feat(book/big-o): add new chapter on how to determine big o from code.
amejiarosario Sep 29, 2020
dec47fb
Merge pull request #81 from amejiarosario/feat/revision-part-one
amejiarosario Sep 29, 2020
29f374a
:bookmark: chore(release): 2.2.0
semantic-release-bot Sep 29, 2020
1392938
Update introduction.asc
dahalnischal Oct 2, 2020
e679993
Merge pull request #83 from amejiarosario/feat/divide-and-conquer-exe…
amejiarosario Oct 2, 2020
4505eb6
fix(book): add introduction
amejiarosario Oct 2, 2020
db19ea9
Merge pull request #84 from amejiarosario/patch-2
amejiarosario Oct 2, 2020
b047c23
:bookmark: chore(release): 2.2.1
semantic-release-bot Oct 2, 2020
249de5d
feat(treeMap): get last entry (highest value)
amejiarosario Oct 3, 2020
3b079c0
Merge pull request #85 from amejiarosario/feat/tree-map-improvements
amejiarosario Oct 3, 2020
1b2d612
:bookmark: chore(release): 2.3.0
semantic-release-bot Oct 3, 2020
1287f29
Update CONTRIBUTING.md
PokhrelAnish Oct 4, 2020
9175b62
Update CONTRIBUTING.md
PokhrelAnish Oct 4, 2020
f5169b5
chore: add examples to contributing
amejiarosario Oct 4, 2020
8135449
chore: improves docs grammar
amejiarosario Oct 4, 2020
f7ebb75
Merge pull request #87 from amejiarosario/PokhrelAnish/master
amejiarosario Oct 4, 2020
04836cd
fix(book/array): improve examples and grammar
amejiarosario Oct 2, 2020
8c7b7be
feat(book/array): add array patterns for solving problems
amejiarosario Oct 17, 2020
8fa2746
feat(book/array): sliding window pattern
amejiarosario Oct 19, 2020
603afc2
Merge pull request #88 from amejiarosario/feat/arrays
amejiarosario Oct 19, 2020
273a9dc
:bookmark: chore(release): 2.4.0
semantic-release-bot Oct 19, 2020
4ba6fe0
chore(book/array): improve exercises
amejiarosario Oct 19, 2020
dc47b76
Merge pull request #89 from amejiarosario/feat/arrays
amejiarosario Oct 19, 2020
f7b8d59
feat(book/hashmap): add code examples and patterns
amejiarosario Oct 22, 2020
edf11d9
Merge pull request #91 from amejiarosario/feat/hashmap
amejiarosario Oct 22, 2020
0d7a14b
:bookmark: chore(release): 2.5.0
semantic-release-bot Oct 22, 2020
7659ac6
chore(docs): improve comments here and there
amejiarosario Oct 23, 2020
fcf3db6
fix(linkedlist): rename indexOf to getIndex to make it clearer
amejiarosario Oct 23, 2020
ba110e2
fix(linkedlist): refactored methods and improve book images and
amejiarosario Oct 23, 2020
2c8d383
Merge pull request #92 from amejiarosario/feat/linkedlist
amejiarosario Oct 23, 2020
0e12523
:bookmark: chore(release): 2.5.1
semantic-release-bot Oct 23, 2020
0f13f90
feat(book): add chapter numbers
amejiarosario Oct 25, 2020
8cd126d
feat(book/linkedlist): linked lists techniques and common patterns
amejiarosario Oct 27, 2020
571834a
fix(test): refactor tests
amejiarosario Oct 28, 2020
22972c3
Merge pull request #93 from amejiarosario/feat/linkedlist
amejiarosario Oct 28, 2020
bd9e1e4
:bookmark: chore(release): 2.6.0
semantic-release-bot Oct 28, 2020
c1cf57a
fix(book/set): split Set chapter into Hash Set and Tree Set for better
amejiarosario Oct 30, 2020
2b96f00
feat(book/linkedlist): add applications
amejiarosario Oct 30, 2020
6c39aae
chore(book): improve grammar of various chapters
amejiarosario Oct 30, 2020
b3167f9
feat(book): show companies asked questions
amejiarosario Oct 30, 2020
1fced28
Merge pull request #94 from amejiarosario/feat/set-improvements
amejiarosario Oct 30, 2020
b3039ab
:bookmark: chore(release): 2.7.0
semantic-release-bot Oct 30, 2020
38a4178
fix(book): update company names
amejiarosario Dec 2, 2020
d70aec2
Merge pull request #95 from amejiarosario/fix/update-companies
amejiarosario Dec 2, 2020
96cc1cb
:bookmark: chore(release): 2.7.1
semantic-release-bot Dec 2, 2020
b2a82c0
Rename fibonacci-dynamic-programming (fix typo)
knoxknox Dec 16, 2020
ded0a70
fix(book): Rename fibonacci-dynamic-programming
knoxknox Dec 16, 2020
5b0d703
Merge pull request #97 from amejiarosario/fix/typo
amejiarosario Dec 17, 2020
7dd9df8
Merge pull request #96 from knoxknox/fix-naming
amejiarosario Dec 17, 2020
65b6edd
:bookmark: chore(release): 2.7.2
semantic-release-bot Dec 17, 2020
c137930
fix(book/hashmap): exercise example and add tests
amejiarosario Dec 22, 2020
c7c7947
fix(book/graph): add comments for runtimes using hashset implementations
amejiarosario Dec 22, 2020
1d75301
fix(book/bst): better wording
amejiarosario Dec 22, 2020
436848d
fixes format
amejiarosario Dec 22, 2020
4350fca
Merge pull request #98 from amejiarosario/fix/sam-findings
amejiarosario Dec 22, 2020
3c32d0e
:bookmark: chore(release): 2.7.3
semantic-release-bot Dec 22, 2020
6b9a4e8
fix(bst): some typos on the code
amejiarosario Jan 9, 2021
2090ea2
:bookmark: chore(release): 2.7.4
semantic-release-bot Jan 9, 2021
1812da7
Update README.md
amejiarosario Feb 11, 2021
cec3b04
chore(graph): fix typo
amejiarosario May 18, 2021
d350da8
fix(bst): on duplicates values the same node is returned
amejiarosario May 24, 2021
1c05026
Merge pull request #100 from amejiarosario/fix/nadhem-findings
amejiarosario May 24, 2021
03bafbb
:bookmark: chore(release): 2.7.5
semantic-release-bot May 24, 2021
e03875d
Update tree-intro.asc
eraygundogmus Sep 13, 2021
9243b24
Merge pull request #104 from eraygundogmus/patch-1
amejiarosario Sep 23, 2021
5ac3cd9
Update quick-sort.asc
ivanji Nov 9, 2021
02d9f48
Merge pull request #107 from ivanji/patch-2
amejiarosario Nov 14, 2021
ccfcfe6
fix(graph): minor typo in bfs code documentation
onethirtyfive Nov 27, 2021
438e8dd
Merge pull request #111 from onethirtyfive/fix-graph-bfs-documentation
amejiarosario Nov 30, 2021
ae41553
:bookmark: chore(release): 2.7.6
semantic-release-bot Nov 30, 2021
5b49d8a
fix(runtimes/02-binary-search):fixes binary search iterative
gabrielastelescu May 19, 2022
cde6e8a
Update heap.js
Balaji1202 May 29, 2022
c9249d3
chore(binary-search): consolidate test for multiple implementations
amejiarosario Dec 10, 2022
41205d6
Merge pull request #113 from gabrielastelescu/binary-search-iterative
amejiarosario Dec 10, 2022
c20acfb
Merge pull request #114 from Balaji1202/patch-1
amejiarosario Dec 20, 2022
fefb06a
Fix return of unshift method
caiquecastro Dec 26, 2022
844644d
Merge pull request #117 from caiquecastro/patch-1
amejiarosario Dec 28, 2022
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
2 changes: 1 addition & 1 deletion book/content/dedication.asc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[dedication]
== Dedication

_To my wife Nathalie that supported me in my long hours of writing and my baby girl Abigail._
_To my wife Nathalie who supported me in my long hours of writing and my baby girl Abigail._
20 changes: 10 additions & 10 deletions book/content/part01/algorithms-analysis.asc
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ endif::[]

=== Fundamentals of Algorithms Analysis

Probably you are reading this book because you want to write better and faster code.
You are probably reading this book because you want to write better and faster code.
How can you do that? Can you time how long it takes to run a program? Of course, you can!
[big]#⏱#
However, if you run the same program on a smartwatch, cellphone or desktop computer, it will take different times.
Expand All @@ -15,7 +15,7 @@ image::image3.png[image,width=528,height=137]
Wouldn't it be great if we can compare algorithms regardless of the hardware where we run them?
That's what *time complexity* is for!
But, why stop with the running time?
We could also compare the memory "used" by different algorithms, and we called that *space complexity*.
We could also compare the memory "used" by different algorithms, and we call that *space complexity*.

.In this chapter you will learn:
- What’s the best way to measure the performance of your code regardless of what hardware you use.
Expand Down Expand Up @@ -59,16 +59,16 @@ To give you a clearer picture of how different algorithms perform as the input s
|=============================================================================================
|Input size -> |10 |100 |10k |100k |1M
|Finding if a number is odd |< 1 sec. |< 1 sec. |< 1 sec. |< 1 sec. |< 1 sec.
|Sorting elements in array with merge sort |< 1 sec. |< 1 sec. |< 1 sec. |few sec. |20 sec.
|Sorting elements in array with Bubble Sort |< 1 sec. |< 1 sec. |2 minutes |3 hours |12 days
|Finding all subsets of a given set |< 1 sec. |40,170 trillion years |> centillion years |∞ |∞
|Find all permutations of a string |4 sec. |> vigintillion years |> centillion years |∞ |∞
|Sorting array with merge sort |< 1 sec. |< 1 sec. |< 1 sec. |few sec. |20 sec.
|Sorting array with Selection Sort |< 1 sec. |< 1 sec. |2 minutes |3 hours |12 days
|Finding all subsets |< 1 sec. |40,170 trillion years |> centillion years |∞ |∞
|Finding string permutations |4 sec. |> vigintillion years |> centillion years |∞ |∞
|=============================================================================================

Most algorithms are affected by the size of the input (`n`). Let's say you need to arrange numbers in ascending order. Sorting ten items will naturally take less time than sorting out 2 million. But, how much longer? As the input size grow, some algorithms take proportionally more time, we classify them as <> runtime [or `O(n)`]. Others might take power two longer; we call them <> running time [or `O(n^2^)`].

From another perspective, if you keep the input size the same and run different algorithms implementations, you would notice the difference between an efficient algorithm and a slow one. For example, a good sorting algorithm is <>, and an inefficient algorithm for large inputs is <>.
Organizing 1 million elements with merge sort takes 20 seconds while bubble sort takes 12 days, ouch!
Organizing 1 million elements with merge sort takes 20 seconds while selection sort takes 12 days, ouch!
The amazing thing is that both programs are solving the same problem with equal data and hardware; and yet, there's a big difference in time!

After completing this book, you are going to _think algorithmically_.
Expand Down Expand Up @@ -135,7 +135,7 @@ There’s a notation called *Big O*, where `O` refers to the *order of the funct

TIP: Big O = Big Order of a function.

If you have a program which runtime is:
If you have a program that has a runtime of:

_7n^3^ + 3n^2^ + 5_

Expand All @@ -144,7 +144,7 @@ You can express it in Big O notation as _O(n^3^)_. The other terms (_3n^2^ + 5_)
Big O notation, only cares about the “biggest” terms in the time/space complexity. So, it combines what we learn about time and space complexity, asymptotic analysis and adds a worst-case scenario.

.All algorithms have three scenarios:
* Best-case scenario: the most favorable input arrange where the program will take the least amount of operations to complete. E.g., array already sorted is beneficial for some sorting algorithms.
* Best-case scenario: the most favorable input arrangement where the program will take the least amount of operations to complete. E.g., an array that's already sorted is beneficial for some sorting algorithms.
* Average-case scenario: this is the most common case. E.g., array items in random order for a sorting algorithm.
* Worst-case scenario: the inputs are arranged in such a way that causes the program to take the longest to complete. E.g., array items in reversed order for some sorting algorithm will take the longest to run.

Expand All @@ -154,7 +154,7 @@ TIP: Big O only cares about the highest order of the run time function and the w

WARNING: Don't drop terms that are multiplying other terms. _O(n log n)_ is not equivalent to _O(n)_. However, _O(n + log n)_ is.

There are many common notations like polynomial, _O(n^2^)_ like we saw in the `getMin` example; constant _O(1)_ and many more that we are going to explore in the next chapter.
There are many common notations like polynomial, _O(n^2^)_ as we saw in the `getMin` example; constant _O(1)_ and many more that we are going to explore in the next chapter.

Again, time complexity is not a direct measure of how long a program takes to execute, but rather how many operations it performs given the input size. Nevertheless, there’s a relationship between time complexity and clock time as we can see in the following table.
(((Tables, Intro, Input size vs clock time by Big O)))
Expand Down
22 changes: 11 additions & 11 deletions book/content/part01/big-o-examples.asc
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ endif::[]

There are many kinds of algorithms. Most of them fall into one of the eight time complexities that we are going to explore in this chapter.

.Eight Running Time complexity You Should Know
.Eight Running Time Complexities You Should Know
- Constant time: _O(1)_
- Logarithmic time: _O(log n)_
- Linear time: _O(n)_
Expand All @@ -17,7 +17,7 @@ There are many kinds of algorithms. Most of them fall into one of the eight time
- Exponential time: _O(2^n^)_
- Factorial time: _O(n!)_

We a going to provide examples for each one of them.
We are going to provide examples for each one of them.

Before we dive in, here’s a plot with all of them.

Expand All @@ -30,7 +30,7 @@ The above chart shows how the running time of an algorithm is related to the amo
==== Constant
(((Constant)))
(((Runtime, Constant)))
Represented as *O(1)*, it means that regardless of the input size the number of operations executed is always the same. Let’s see an example.
Represented as *O(1)*, it means that regardless of the input size, the number of operations executed is always the same. Let’s see an example:

[#constant-example]
===== Finding if an array is empty
Expand All @@ -47,7 +47,7 @@ include::{codedir}/runtimes/01-is-empty.js[tag=isEmpty]

Another more real life example is adding an element to the begining of a <>. You can check out the implementation <>.

As you can see, in both examples (array and linked list) if the input is a collection of 10 elements or 10M it would take the same amount of time to execute. You can't get any more performant than this!
As you can see in both examples (array and linked list), if the input is a collection of 10 elements or 10M, it would take the same amount of time to execute. You can't get any more performant than this!

[[logarithmic]]
==== Logarithmic
Expand All @@ -68,7 +68,7 @@ The binary search only works for sorted lists. It starts searching for an elemen
include::{codedir}/runtimes/02-binary-search.js[tag=binarySearchRecursive]
----

This binary search implementation is a recursive algorithm, which means that the function `binarySearch` calls itself multiple times until the solution is found. The binary search splits the array in half every time.
This binary search implementation is a recursive algorithm, which means that the function `binarySearchRecursive` calls itself multiple times until the solution is found. The binary search splits the array in half every time.

Finding the runtime of recursive algorithms is not very obvious sometimes. It requires some tools like recursion trees or the https://adrianmejia.com/blog/2018/04/24/analysis-of-recursive-algorithms/[Master Theorem]. The `binarySearch` divides the input in half each time. As a rule of thumb, when you have an algorithm that divides the data in half on each call you are most likely in front of a logarithmic runtime: _O(log n)_.

Expand All @@ -92,8 +92,8 @@ include::{codedir}/runtimes/03-has-duplicates.js[tag=hasDuplicates]

.`hasDuplicates` has multiple scenarios:
* *Best-case scenario*: first two elements are duplicates. It only has to visit two elements.
* *Worst-case scenario*: no duplicated or duplicated are the last two. In either case, it has to visit every item on the array.
* *Average-case scenario*: duplicates are somewhere in the middle of the collection. Only, half of the array will be visited.
* *Worst-case scenario*: no duplicates or duplicates are the last two. In either case, it has to visit every item in the array.
* *Average-case scenario*: duplicates are somewhere in the middle of the collection. Only half of the array will be visited.

As we learned before, the big O cares about the worst-case scenario, where we would have to visit every element on the array. So, we have an *O(n)* runtime.

Expand Down Expand Up @@ -147,19 +147,19 @@ Usually they have double-nested loops, where each one visits all or most element
[[quadratic-example]]
===== Finding duplicates in an array (naïve approach)

If you remember we have solved this problem more efficiently on the <> section. We solved this problem before using an _O(n)_, let’s solve it this time with an _O(n^2^)_:
If you remember, we have solved this problem more efficiently in the <> section. We solved this problem before using an _O(n)_, let’s solve it this time with an _O(n^2^)_:

// image:image12.png[image,width=527,height=389]

.Naïve implementation of has duplicates function
.Naïve implementation of hasDuplicates function
[source, javascript]
----
include::{codedir}/runtimes/05-has-duplicates-naive.js[tag=hasDuplicates]
----

As you can see, we have two nested loops causing the running time to be quadratic. How much difference is there between a linear vs. quadratic algorithm?

Let’s say you want to find a duplicated middle name in a phone directory book of a city of ~1 million people. If you use this quadratic solution you would have to wait for ~12 days to get an answer [big]#🐢#; while if you use the <> you will get the answer in seconds! [big]#🚀#
Let’s say you want to find a duplicated middle name in a phone directory book of a city of ~1 million people. If you use this quadratic solution, you would have to wait for ~12 days to get an answer [big]#🐢#; while if you use the <>, you will get the answer in seconds! [big]#🚀#

[[cubic]]
==== Cubic
Expand All @@ -186,7 +186,7 @@ include::{codedir}/runtimes/06-multi-variable-equation-solver.js[tag=findXYZ]

WARNING: This is just an example, there are better ways to solve multi-variable equations.

As you can see three nested loops usually translates to O(n^3^). If you have a four variable equation and four nested loops it would be O(n^4^) and so on when we have a runtime in the form of _O(n^c^)_, where _c > 1_, we refer to this as a *polynomial runtime*.
As you can see three nested loops usually translates to O(n^3^). If you have a four variable equation and four nested loops it would be O(n^4^) and so on. When we have a runtime in the form of _O(n^c^)_, where _c > 1_, we refer to this as a *polynomial runtime*.

[[exponential]]
==== Exponential
Expand Down
2 changes: 1 addition & 1 deletion book/content/part02/array-vs-list-vs-queue-vs-stack.asc
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ In this part of the book, we explored the most used linear data structures such
* You want constant time to remove/add from extremes of the list.

.Use a Queue when:
* You need to access your data in a first-come, first served basis (FIFO).
* You need to access your data on a first-come, first served basis (FIFO).
* You need to implement a <>

.Use a Stack when:
Expand Down
18 changes: 9 additions & 9 deletions book/content/part02/array.asc
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ TIP: Strings are a collection of Unicode characters and most of the array concep

.Fixed vs. Dynamic Size Arrays
****
Some programming languages have fixed size arrays like Java and C++. Fixed size arrays might be a hassle when your collection gets full, and you have to create a new one with a bigger size. For that, those programming languages also have built-in dynamic arrays: we have `vector` in C++ and `ArrayList` in Java. Dynamic programming languages like JavaScript, Ruby, Python use dynamic arrays by default.
Some programming languages have fixed size arrays like Java and C++. Fixed size arrays might be a hassle when your collection gets full, and you have to create a new one with a bigger size. For that, those programming languages also have built-in dynamic arrays: we have `vector` in C++ and `ArrayList` in Java. Dynamic programming languages like JavaScript, Ruby, and Python use dynamic arrays by default.
****

Arrays look like this:
Expand All @@ -29,7 +29,7 @@ Arrays are a sequential collection of elements that can be accessed randomly usi

==== Insertion

Arrays are built-in into most languages. Inserting an element is simple; you can either add them on creation time or after initialization. Below you can find an example for both cases:
Arrays are built-in into most languages. Inserting an element is simple; you can either add them at creation time or after initialization. Below you can find an example for both cases:

.Inserting elements into an array
[source, javascript]
Expand All @@ -44,7 +44,7 @@ array2[100] = 2;
array2 // [empty × 3, 1, empty × 96, 2]
----

Using the index, you can replace whatever value you want. Also, you don't have to add items next to each other. The size of the array will dynamically expand to accommodate the data. You can reference values in whatever index you like index 3 or even 100! In the `array2` we inserted 2 numbers, but the length is 101, and there are 99 empty spaces.
Using the index, you can replace whatever value you want. Also, you don't have to add items next to each other. The size of the array will dynamically expand to accommodate the data. You can reference values at whatever index you like: index 3 or even 100! In `array2`, we inserted 2 numbers but the length is 101 and there are 99 empty spaces.

[source, javascript]
----
Expand Down Expand Up @@ -87,7 +87,7 @@ const array = [2, 5, 1, 9, 6, 7];
array.splice(1, 0, 111); // ↪️ [] <1>
// array: [2, 111, 5, 1, 9, 6, 7]
----
<1> at the position `1`, delete `0` elements and insert `111`.
<1> at position `1`, delete `0` elements and insert `111`.

The Big O for this operation would be *O(n)* since in worst case it would move most of the elements to the right.

Expand Down Expand Up @@ -132,7 +132,7 @@ const array = [2, 5, 1, 9, 6, 7];
array[4]; // ↪️ 6
----

Searching by index takes constant time, *O(1)*, to retrieve values out of the array. If we want to get fancier we can create a function:
Searching by index takes constant time - *O(1)* - to retrieve values out of the array. If we want to get fancier, we can create a function:

// image:image17.png[image,width=528,height=293]

Expand Down Expand Up @@ -184,7 +184,7 @@ We would have to loop through the whole array (worst case) or until we find it:

==== Deletion

Deleting (similar to insertion) there are three possible scenarios, removing at the beginning, middle or end.
There are three possible scenarios for deletion (similar to insertion): removing at the beginning, middle or end.

===== Deleting element from the beginning

Expand Down Expand Up @@ -223,7 +223,7 @@ array.splice(2, 1); // ↪️[2] <1>
----
<1> delete 1 element at position 2

Deleting from the middle might cause most the elements of the array to move back one position to fill in for the eliminated item. Thus, runtime: O(n).
Deleting from the middle might cause most of the elements of the array to move up one position to fill in for the eliminated item. Thus, runtime: O(n).

===== Deleting element from the end

Expand All @@ -237,7 +237,7 @@ array.pop(); // ↪️111
// array: [2, 5, 1, 9]
----

No element other element has been shifted, so it’s an _O(1)_ runtime.
No other element has been shifted, so it’s an _O(1)_ runtime.

.JavaScript built-in `array.pop`
****
Expand All @@ -264,7 +264,7 @@ To sum up, the time complexity of an array is:
(((Runtime, Constant)))
(((Tables, Linear DS, JavaScript Array buit-in operations Complexities)))

.Array Operations timex complexity
.Array Operations time complexity
|===
| Operation | Time Complexity | Usage
| push ^| O(1) | Insert element to the right side.
Expand Down
Loading