Commit graph

224 commits

Author SHA1 Message Date
krahets
9731a46d67 Fix a definition. 2023-08-27 00:50:18 +08:00
krahets
f5dda8d99a Polish the content 2023-08-21 03:06:53 +08:00
krahets
2626de8d0b Polish the chapter
introduction, computational complexity.
2023-08-20 14:51:39 +08:00
krahets
c310edb672 Polish the chapter of array and linkedlist 2023-08-17 05:13:19 +08:00
Justin Tse
5d7e0a59b1
Add JavaScript and TypeScript code of top_k and update some code style (#686)
* Update JS and TS code style

* Add JavaScript and TypeScript code of top_k

* Update top_k.ts

* Apply suggestions from code review

Co-authored-by: Justin Tse <xiefahit@gmail.com>

* Apply suggestions from code review

Co-authored-by: Justin Tse <xiefahit@gmail.com>

---------

Co-authored-by: Yudong Jin <krahets@163.com>
2023-08-17 05:00:35 +08:00
William Yuan
ec82be7dc2
feat(tree): Add the array representation of the binary tree(js,ts) (#681)
* fix: fixed the bug of arrToTree function

* feat(tree): Add the array representation of the binary tree(js,ts)

* refactor: Make the arrToTree method match the method in java
2023-08-13 19:30:50 +08:00
William Yuan
e97eee0e18
feat(chapter_hashing): Add js and ts codes for chapter hashing (#675)
* refactor(chapter_hashing): Remove unnecessary chaining operator

* feat(chapter_hashing): Add js and ts codes for chapter 6

* refactor(chapter_hashing): Optimize the remove function logic

* refactor(chapter_hashing): Remove unnecessary chaining operator

* refactor(chapter_hashing): use const instead of let
2023-08-10 23:04:41 +08:00
krahets
932d14644d Polish the content
Polish the chapter preface, introduction and complexity anlysis
2023-08-08 23:16:33 +08:00
krahets
08e4924054 Finetune 2023-08-04 05:25:22 +08:00
Yudong Jin
71074d88f6
Add the section of binary search insertion. (#671)
Refactor the section of binary search edge.
Finetune the figures of binary search.
2023-08-04 05:16:56 +08:00
William Yuan
70784a1ec3
feat(chapter_backtracking): Add js and ts codes for chapter 13.3 (#667)
* feat(chapter_dynamic_programming): Add js and ts codes for chapter 14.1

* style(chapter_dynamic_programming): format code

* refactor(chapter_dynamic_programming): remove main definition and add type

* feat(chapter_backtracking): Add js and ts codes for chapter 13.3

* feat(chapter_divide_and_conquer): Add js and ts codes for chapter 12.2

* feat(chapter_divide_and_conquer): Add js and ts codes for chapter 12.3

* feat(chapter_divide_and_conquer): Add js and ts codes for chapter 12.4

* style(chapter_divide_and_conquer): fix typo

* refactor: Use === instead of == in js and ts
2023-08-03 14:44:49 +08:00
William Yuan
35e9c8c209
feat(chapter_dynamic_programming): Add js and ts codes for chapter 14.1 (#658)
* feat(chapter_dynamic_programming): Add js and ts codes for chapter 14.1

* style(chapter_dynamic_programming): format code

* refactor(chapter_dynamic_programming): remove main definition and add type
2023-07-29 02:06:11 +08:00
krahets
b067016bfa Update preorder_traversal_iii. 2023-07-25 16:39:38 +08:00
krahets
bba62bbe75 Fix the code of preorder_traversal_iii_compact 2023-07-21 22:08:26 +08:00
krahets
c54536d1a1 Modify the problem of preorder_traversal_iii 2023-07-19 16:37:12 +08:00
krahets
69920a0599 Fix binary search.
Finetune a figure in intro_to_dp.
2023-07-01 20:07:21 +08:00
krahets
9fc1a0b2b3 Update n_queens code. 2023-06-21 02:56:28 +08:00
krahets
d62156fb58 Fix two_sum.js and .ts 2023-06-16 21:28:48 +08:00
Yudong Jin
9563965a20
Add the codes of hashmap (#553)
of chaining and open addressing
2023-06-14 02:01:06 +08:00
krahets
698c2e7fe5 Fix some codes and a figure. 2023-06-05 01:03:39 +08:00
Justin Tse
2532f06c7f
Add JavaScript and TypeScript code of heap sort, selection sort and binary search edge and Fix the indentation of TS code (#545)
* Fix the indentation of TS code

* Add JavaScript and TypeScript code of heap sort, selection sort and binary search edge

* Fix the style of JS and TS code
2023-06-05 00:20:11 +08:00
krahets
6377e3316a Fix a comment in my_list.xx 2023-06-03 22:18:28 +08:00
krahets
b39e79be85 Fix remove() in binary search tree. 2023-05-26 20:34:22 +08:00
krahets
11c835d79c Update the section of heap. 2023-05-25 20:25:19 +08:00
krahets
eb8df49993 Update bubble sort and insertion sort. 2023-05-23 21:20:14 +08:00
krahets
89a9741e9e Fix some comments. 2023-05-22 23:13:54 +08:00
krahets
f6d290d903 Update the comments of bubble sort
and insertion sort
2023-05-22 23:05:37 +08:00
krahets
d95c628eef Fix the test case of binary search. 2023-05-21 19:29:24 +08:00
krahets
d3cc149c5a Merge the chapter of binary tree and searching. 2023-05-21 19:26:52 +08:00
krahets
c3e7455285 Refactor the section of bianry search. 2023-05-21 04:51:32 +08:00
krahets
399e5df39a Polish some cotents. 2023-05-18 20:27:58 +08:00
krahets
817b4598d5 Fix a comment in binary_search_tree code 2023-05-17 19:04:46 +08:00
krahets
649d8c4c86 Fix the indentation of JS and TS code. 2023-05-14 01:40:19 +08:00
Justin Tse
b52a98f178
Add JavaScript and TypeScript code of permutations and n_queens (Chapter of Backtracking) (#494)
* Add JavaScript and TypeScript code of permutations and n_queens (Chapter of Backtracking)

* Update n_queens.js

* Update permutations_i.js

* Update permutations_ii.js

* Update n_queens.ts

* Update permutations_i.ts

* Update permutations_ii.ts

---------

Co-authored-by: Yudong Jin <krahets@163.com>
2023-05-14 01:18:40 +08:00
Justin Tse
01345c23ca
Add JavaScript and TypeScript code of preorder traversal (Chapter of Backtracking) (#490)
* Add JavaScript and TypeScript code of preorder traversal (Chapter of Backtracking)

* Update preorder_traversal_iii_compact.ts
2023-05-11 23:46:12 +08:00
krahets
fe69f7240d Add figures to replace_linear_by_hashing.md 2023-05-09 00:36:18 +08:00
krahets
de579aa3f4 Fix the file headers. 2023-04-23 19:36:07 +08:00
krahets
c4ea4e39f3 Fomrat the JS and TS codes with prettier. 2023-04-17 21:58:11 +08:00
krahets
9a98ff8a5e Format the C code in Clang-Format Style: Microsoft 2023-04-17 21:13:15 +08:00
Yudong Jin
881d573790
Refactor the articles related to searching algorithm. Add the chapter of binary search. Add the section of searching algorithm revisited. (#464) 2023-04-17 18:22:18 +08:00
krahets
f7ae9c8a02 Fix the return type of binary search tree and avl tree 2023-04-14 05:47:20 +08:00
krahets
0bec52d7cc Polish the chapter of heap, introduction, preface.
Replace "其它" with "其他"
2023-04-09 19:12:37 +08:00
Yudong Jin
1c8b7ef559
refactor: Replace 结点 with 节点 (#452)
* Replace 结点 with 节点
Update the footnotes in the figures

* Update mindmap

* Reduce the size of the mindmap.png
2023-04-09 04:32:17 +08:00
Justin Tse
56243ccc5b
Add JavaScript and TypeScript code of bucket sort, counting sort and radix sort (Chapter of Sorting) (#451)
* Add JavaScript and TypeScript code of bucket sort (Chapter of Sorting)

* Add JavaScript and TypeScript code of counting sort (Chapter of Sorting)

* Add JavaScript and TypeScript code of radix sort (Chapter of Sorting)
2023-04-09 02:59:06 +08:00
krahets
518b9efabc Update a comment in array_hash_map 2023-03-15 03:48:31 +08:00
krahets
d5afd93571 Update array_hash_map 2023-03-15 03:11:43 +08:00
Yudong Jin
28aacccf44
refactor: Replace 'poll' with 'pop' in Heap (#416) 2023-03-13 22:31:05 +08:00
Yudong Jin
8aebbaad21
refactor: Replace poll with pop in Queue and Deque (#415) 2023-03-13 21:58:21 +08:00
krahets
ca261a8f46 Update the chapter preface. 2023-03-03 21:54:04 +08:00
zhuoqinyue
8c65345b76
feat: add array_deque for JS and TS (#397)
* feat: add array_deque for JS and TS

* feat: update the information

* Update array_deque.ts

* Update array_deque.js

* use private property

* Update array_deque.js

---------

Co-authored-by: steak-zhuo <zhuoqinyue@gmail.com>
Co-authored-by: Yudong Jin <krahets@163.com>
2023-03-03 21:25:25 +08:00
krahets
7c501140f0 Update code style for Python 2023-03-03 03:07:22 +08:00
Justin Tse
e4a98bc9c5
Update JavaScript and TypeScript codes for all chapters, rename JavaScript and TypeScript import folder to modules (#402)
* Update JavaScript and TypeScript codes

* Rename JavaScript and TypeScript import folder to modules
2023-03-03 01:34:53 +08:00
krahets
9ea24e8b26 Change the operations sequence of the likedlist's insert() method. 2023-02-27 20:25:43 +08:00
krahets
93fb0075cc Update graph_bfs.js and graph_dfs.js 2023-02-25 02:19:48 +08:00
zhuoqinyue
e8f311e900
update: Use function declarations instead of function expressions. (#385)
Co-authored-by: steak-zhuo <zhuoqinyue@gmail.com>
2023-02-25 02:15:46 +08:00
zhuoqinyue
2d421de984
feat: add bfs and dfs for JS and TS (#377)
* add bfs and dfs for JS and TS

* update the type

* Apply suggestions from code review

Co-authored-by: Justin Tse <xiefahit@gmail.com>

* Update graph_dfs.ts

* Update graph_bfs.ts

* Update graph_dfs.ts

* Update graph_bfs.ts

* Update graph_dfs.js

* Update graph_bfs.js

---------

Co-authored-by: steak-zhuo <zhuoqinyue@gmail.com>
Co-authored-by: Yudong Jin <krahets@163.com>
Co-authored-by: Justin Tse <xiefahit@gmail.com>
2023-02-25 01:11:11 +08:00
krahets
adbb12c011 Fix a comment in graph_adjacency_list 2023-02-23 20:32:26 +08:00
krahets
0b72fef381 Fix quick_sort.py 2023-02-21 21:51:56 +08:00
zhuoqinyue
b89ea3eba4
Add vertex class for javascript and typescript (#370)
* add vertex class for javascript and typescript

* update the adjacencyList

* update the graph_adjacency_list file

* update the implicit type

---------

Co-authored-by: steak-zhuo <zhuoqinyue@gmail.com>
2023-02-21 21:35:44 +08:00
方圆
f0d8d8b1b0
feat: add ArrayDeque (#348)
* 双向队列: java 代码

* 双向队列: markdown 内容

* Rewrite array_deque.java
Update array_queue.java, linkedlist_deque.java

* Add ArrayDeque figures and rewrite the contents

---------

Co-authored-by: krahets <krahets@163.com>
2023-02-16 02:17:15 +08:00
krahets
7238c560d1 Update binary_tree_bfs codes 2023-02-15 03:36:22 +08:00
krahets
8e0080f003 Update graph codes 2023-02-15 03:35:54 +08:00
zhuoqinyue
321ea1d6ad
Add graph_adjacency_matrix for javascript and typescript (#355)
* add graph_adjacency_matrix for javascript and typescript

* Fix the initial edges

* fix the method

---------

Co-authored-by: steak-zhuo <zhuoqinyue@gmail.com>
2023-02-11 00:44:12 +08:00
krahets
300016393b Add code source blocks to the chapter Graph.
Fix "函数" and "方法"
2023-02-10 01:04:26 +08:00
Justin Tse
d37c71b928
Add JavaScript and TypeScript code for section graph adjacency list (#358) 2023-02-10 00:42:45 +08:00
Justin Tse
1eb0d91978
Update the docs for the section of AVL tree and style (#351)
Co-authored-by: Yudong Jin <krahets@163.com>
2023-02-09 00:36:06 +08:00
krahets
05f0054005 Add build script for JS and TS codes. 2023-02-08 19:45:06 +08:00
Leo.Cai
7666632d0c
Add heap part js code (#339)
* Add heap part js code

* Update heap.md

* Update heap.md

* Format the code style and fix a bug.

* and fix the style in heap.md

* fix the style

---------

Co-authored-by: Yudong Jin <krahets@163.com>
2023-02-07 20:48:54 +08:00
krahets
8f512c2840 Update code extractor of Java. 2023-02-07 19:05:19 +08:00
krahets
ecbf2d1560 1. Add build script for Java.
2. Add height limitation for code blocks in extra.css.
3. Fix "节点" to "结点".
2023-02-07 04:43:52 +08:00
Justin Tse
b14568151c
Add TypeScript code and docs to AVL tree and the coding style for Typescript and JavaScript (#342)
* Add TypeScript code and docs to AVL tree and update JavaScript style

* Update the coding style for Typescript and JavaScript
2023-02-07 01:21:58 +08:00
zhuoqinyue
c4b510038c
Add linkedlist_deque for typescript and javascript (#326)
* add linkedlist_deque for typescript and javascript

* update typescript and javascript examples for the deque.md

* keep the same name

* update the doc

* Update deque.md

---------

Co-authored-by: steak-zhuo <zhuoqinyue@gmail.com>
Co-authored-by: Yudong Jin <krahets@163.com>
2023-02-06 01:31:09 +08:00
Justin Tse
bc88e52955
Add JavaScript and TypeScript code and docs for Section Space Complexity (#331)
* Fix bug before commit 5eae708

* Update queue.md

* Update the coding style for JavaScript

* Add JavaScript and TypeScript code for Section Space Complexity

* Add JavaScript and TypeScript code to docs for Section Space Complexity

* Update hashing_search.js

---------

Co-authored-by: Yudong Jin <krahets@163.com>
2023-02-06 01:24:22 +08:00
Justin Tse
6ad8a66a7c
Update the coding style for JavaScript (#329)
* Fix bug before commit 5eae708

* Update queue.md

* Update the coding style for JavaScript

---------

Co-authored-by: Yudong Jin <krahets@163.com>
2023-02-05 15:40:30 +08:00
Leo.Cai
e3f0151a7f
add js codes to avl_tree.js (#323)
* add js codes to avl_tree.js

* fixed format wrong

* Update avl_tree.js

---------

Co-authored-by: Yudong Jin <krahets@163.com>
2023-02-05 14:15:05 +08:00
Yudong Jin
f14e3e4c57 Update linear_search and hashing_search. 2023-02-04 23:49:37 +08:00
Justin Tse
62114ce79a
Fix bug before commit 5eae708 (#325)
* Fix bug before commit 5eae708

* Update queue.md

---------

Co-authored-by: Yudong Jin <krahets@163.com>
2023-02-04 21:26:14 +08:00
Yudong Jin
7d0d3df886 Update deque.js and deque.ts 2023-02-04 14:59:24 +08:00
zhuoqinyue
1d1d13ec0e
Add deque for JavaScript and typescript (#267)
* add deque in javascript and typescript

* update the variables name

* update the time complexity

* Directly operating on the Array

* fix the ts file

* update the method complexity

* update the js file

---------

Co-authored-by: steak-zhuo <zhuoqinyue@gmail.com>
2023-02-04 14:55:11 +08:00
Yudong Jin
70dead5cd0 Update worst_best_time_complexity,
leetcode_two_sum
2023-02-03 18:53:15 +08:00
Yudong Jin
7d14c9440e Unify the function naming of
queue from `offer()` to `push()`
2023-02-02 01:43:01 +08:00
Yudong Jin
5eae708035 Fix array queue. 2023-02-01 03:23:29 +08:00
Yudong Jin
ddd5562b60 Fix the index out of bound check in my_list. 2023-01-30 17:50:07 +08:00
Yudong Jin
2336fe1d50 Update the comments in
binary_search_tree and avl_tree.
2023-01-17 01:53:12 +08:00
Yudong Jin
5f0ae848c4 Update medianThree() in quick_sort. 2023-01-15 23:32:58 +08:00
Yudong Jin
3e19205c84 Update a comment in binary_search_tree. 2023-01-15 15:43:06 +08:00
justin
df436633ce Update JavaScript and TypeScript code style (Chapter of Sorting) 2023-01-14 23:23:15 +08:00
Yudong Jin
7a53f1d082
Merge branch 'master' into master 2023-01-11 19:26:19 +08:00
Yudong Jin
daa28be3e4
Merge branch 'master' into binary_search_tree 2023-01-10 13:30:38 +08:00
龚国玮
96d54bff3a test(binary_search_tree): update test param all the language
use param value 7, not 5. function test param value with param value in example picture as same.
2023-01-10 12:16:02 +08:00
steak-zhuo
b7ff82deb5 完善作者信息 2023-01-08 20:39:42 +08:00
steak-zhuo
742b6b632f 完善注释头格式 2023-01-08 20:35:17 +08:00
steak-zhuo
8804ab2940 update the indent 2023-01-08 20:30:55 +08:00
Yudong Jin
dcc3b2e35b Optimize arrToTree function
in java, cpp, py, go, js, ts.
2023-01-08 19:03:22 +08:00
Yudong Jin
1f5f7e14da
Merge pull request #196 from RiverTwilight/patch-1
code: added Typescript and Javascript examples
2023-01-06 23:08:56 +08:00
Yudong Jin
0e49f0053a Update the format of the file headers
of c, cpp, java, js, ts, swift.
2023-01-06 03:39:19 +08:00
Yudong Jin
e96272a06f
Apply suggestions from code review
Co-authored-by: Justin Tse <xiefahit@gmail.com>
2023-01-06 03:14:52 +08:00
RiverTwilight
21096c8d0a lint: added comments 2023-01-05 10:27:48 +08:00
RiverTwilight
8031e0e2c5 lint: added missing keyword 2023-01-05 10:20:19 +08:00
RiverTwilight
7cd1347b44 code(js): worst best time complexity 2023-01-05 10:16:05 +08:00