1224 Commits

Author SHA1 Message Date
c3c991e1e9 Fix the "尾递归优化" to "递归深度优化" in quick_sort. 2025-06-12 21:38:43 +08:00
7751ea1256 update rust heap (#1761) 2025-06-12 20:47:47 +08:00
f42cec0f88 fix(graph): enhance the judgment of boundary conditions for removeEdge functions (#1412) 2025-05-17 17:26:38 +08:00
09f7223067 optimized the js api use of counting_sort chapter for Math.max() (#1748)
* Update counting_sort.ts optimized the Math.max

* Update counting_sort.ts

* Update counting_sort.js

* Update radix_sort.ts

* Update radix_sort.js
2025-05-17 17:17:22 +08:00
bd03b8c66e tiny fix, more readable rust 2025-03-10 17:22:06 +08:00
7e904c8ff6 Update counting_sort.py (#1677)
Since the max function is called to find the maximum value, it doesn't seem necessary to traverse the list and call the max function several times to select the larger value.
2025-03-09 06:39:32 +08:00
98cd3a8076 fix: update the implementation of simple_hash.js and .ts (#1656) 2025-02-25 04:54:48 +08:00
00738f5bb4 idomatic rust (#1652)
* idomatic rust

* Update linkedlist queue/deque
2025-02-10 10:40:29 +08:00
e36453ac25 replace std::mem::replace with std::mem::take according to clippy sugguestion (#1611)
Co-authored-by: frost.wong <happyhackerwqc@foxmail.com>
2025-01-26 06:09:26 +08:00
Rui
1a8b4f6364 Update linkedlist_deque.py (#1625)
According to PEP 8, "Comparisons to singletons like None should always be done with is or is not, never the equality operators."
2025-01-21 18:46:41 +08:00
7503a33e8c fix rust linked list (#1609) 2025-01-14 02:58:17 +08:00
292b107af2 fix(bubble-sort): update incorrect variable name in test output (#1595) 2024-12-20 17:15:22 +08:00
e41b0a3156 Fix the function for printing the queue (#1573)
* renfined!

* Add toArray() function to array_queue.c and array_deque.c

---------

Co-authored-by: Xi-Row <astruggle123@putlook.com>
Co-authored-by: krahets <krahets@163.com>
2024-12-04 19:38:30 +08:00
894e3d536b Update array_binary_tree.cpp (#1568)
打印的小错误
2024-11-24 00:39:33 +08:00
6a74972080 fix(lang: c, chapters: searching, sorting): Some serious errors (#1531)
* fix: correct hash table insertion

* Use a pointer to a pointer instead of a single pointer in the insert function, ensuring proper updates to the hash table
* Bug fixes: This fixes issues with empty results.

* fix: correct issues in radix sort

* Replaced loop-based array copy with memcpy to ensure efficient memory copying in countingSortDigit
* Fixed a bug in radixSort where the maximum value search loop skipped the last element
* Bug fix: Ensures all elements are checked when determining the maximum value in the array

* perf: improve memory management by adding explicit memory release

* revert: Revert to using the old loop override array method and drop specific api's like memcpy.
2024-11-10 02:00:53 +08:00
57cf6b1ea6 fix some typos (#1540) 2024-10-31 21:26:28 +08:00
b3b10f2300 fix(csharp): priority queue comparer initialization (#1542) 2024-10-31 21:25:32 +08:00
68a61f23d5 make dfs same as c/c++ and other small improvement (#1543) 2024-10-31 21:24:56 +08:00
ef3010bd77 idomatic structure rust code, no include macro (#1528) 2024-10-23 18:49:47 +08:00
c12d01a752 Update my_list.js (#1511)
修改insert注释
2024-09-24 17:57:34 +08:00
7a345fc66b Idiomatic rust (#1505) 2024-09-12 17:38:16 +08:00
2cd2a94ce6 fix(backtracking): minor mistake in Rust code for subset_sum_ii (#1487)
* fix(backtracking): minor mistake in Rust code for subset_sum_ii

* Update subset_sum_ii.rs

---------

Co-authored-by: Yudong Jin <krahets@163.com>
2024-08-26 10:12:47 +08:00
8a6ce26f6a idiomatic rust (#1485)
* idomatic rust

* More idiomatic rust

* make rust code more idiomatic

* update
2024-08-23 02:33:47 +08:00
6b2c38cae4 [cpp] Stick with swap (#1474)
* [cpp] Stick with swap

* [cpp] Stick with swap
2024-08-06 15:08:01 +08:00
Rui
2758e06374 remove unnecessary type conversions (#1411) 2024-07-14 18:36:00 +08:00
4190eca41a fix(Go): code comment error (#1404)
* fix: comment error

* fix: comment error in zn-hant version
2024-06-28 19:18:17 +08:00
017b95f003 Make rust more idomatic (#1386) 2024-06-13 15:19:21 +08:00
nil
0774920d7f fix(Go): Update array_queue.go and array_deque.go (#1362)
* 🐞 fix: 队列为空时不应该操作指向

* 🧪 test: 添加pop测试用例

* 🔧 build: 修改testify依赖包

* 🐞 fix: 双向队列为空时,pop不操作指向

* 🔧 build:

Remove third-party packages

* Delete codes/go/go.sum

---------

Co-authored-by: Yudong Jin <krahets@163.com>
2024-05-31 17:38:27 +08:00
3f4220de81 Bug fixes and improvements (#1380)
* preorder, inorder, postorder -> pre-order, in-order, post-order

* Bug fixes

* Bug fixes

* Update what_is_dsa.md

* Sync zh and zh-hant versions

* Sync zh and zh-hant versions.

* Update performance_evaluation.md and time_complexity.md

* Add @khoaxuantu to the landing page.

* Sync zh and zh-hant versions

* Add @ khoaxuantu to the landing page of zh-hant and en versions.
2024-05-31 16:39:06 +08:00
a14be17b74 [feat] add ruby code - chapter dynamic programming (#1378) 2024-05-30 17:11:56 +08:00
63bcdb798a [Rust] make rust part more idomatic and fix panic of backtrack template (#1370)
* Drop unused variable

* Idiomatic rust

* Fix panic template
2024-05-24 16:21:17 +08:00
aa818945f0 feat: Add Ruby code - chapter "Backtracking" (#1373)
* [feat] add ruby code - chapter backtracking

* feat: add ruby code block - chapter backtracking
2024-05-24 15:41:40 +08:00
21be3fdaf8 [Rust] Normalize mid calculation in case overflow (#1363)
* Normalize mid calculate in case overflow

* Change ALL language

* Update merge_sort.py

* Update merge_sort.zig

* Update binary_search_tree.zig

* Update binary_search_recur.py

---------

Co-authored-by: Yudong Jin <krahets@163.com>
2024-05-18 18:19:19 +08:00
0e221540a3 fix(c): Fix malloc allocation of secondary pointers can lead to dump issues (#1367) 2024-05-18 18:17:33 +08:00
9afbc9eda5 [Rust] Use arrays instead of vectors in Chapter 4.1 Array (#1357)
* [Rust] Use array in chapter 4.1

* docs: update comments

* docs: update comments

* docs: update comments

* fix: update slices

* docs: update comments
2024-05-15 18:31:48 +08:00
840692acce Idiomatic rust (#1364) 2024-05-15 18:16:55 +08:00
9e569cf520 feat: add ruby code - chapter "divide and conquer" (#1361) 2024-05-15 18:14:15 +08:00
063a41fa7f [Rust] No need to use mut iter (#1356)
* No need to use mut iter

* Update iter
2024-05-12 14:49:25 +08:00
ebff1cce9f Stick with swap (#1352) 2024-05-11 17:59:44 +08:00
7a96f6a743 Fix panic when array's len is less than 2 (#1353) 2024-05-11 17:59:11 +08:00
1f606d6852 feat: add ruby codes - chapter greedy (#1350) 2024-05-08 18:38:35 +08:00
56a165bf98 cargo fmt code (#1349) 2024-05-08 18:37:38 +08:00
c4a7966882 Bug fixes and improvements (#1348)
* Add "reference" for EN version. Bug fixes.

* Unify the figure reference as "the figure below" and "the figure above".
Bug fixes.

* Format the EN markdown files.

* Replace "" with <u></u> for EN version and bug fixes

* Fix biary_tree_dfs.png

* Fix biary_tree_dfs.png

* Fix zh-hant/biary_tree_dfs.png

* Fix heap_sort_step1.png

* Sync zh and zh-hant versions.

* Bug fixes

* Fix EN figures

* Bug fixes

* Fix the figure labels for EN version
2024-05-06 14:44:48 +08:00
cb32c525e7 feat: Add Ruby code - chapter "Sorting" (#1333)
* feat: add ruby code - chapter sorting

* Update radix_sort.rb

---------

Co-authored-by: Yudong Jin <krahets@163.com>
2024-05-03 19:46:42 +08:00
ee67d3e6a7 Maintain the same semantics as other languages in n_queens.go (#1329) 2024-05-03 19:40:59 +08:00
59d07264fc feat: add ruby code block - bucket sort (#1285)
* feat: add ruby code block - bucket sort

* Update codes/ruby/chapter_sorting/bucket_sort.rb

Co-authored-by: khoaxuantu <68913255+khoaxuantu@users.noreply.github.com>

* Update codes/ruby/chapter_sorting/bucket_sort.rb

Co-authored-by: khoaxuantu <68913255+khoaxuantu@users.noreply.github.com>

* Update bucket_sort.rb

---------

Co-authored-by: khoaxuantu <68913255+khoaxuantu@users.noreply.github.com>
Co-authored-by: Yudong Jin <krahets@163.com>
2024-04-30 16:00:39 +08:00
68f3a453e1 feat: add ruby code block - merge sort (#1260)
* feat(codes/ruby/chapter_sorting/merge_sort.rb): add merge_sort ruby file

* feat(codes/ruby/chapter_sorting/merge_sort.rb): modify comment space

* feat(codes/ruby/chapter_sorting/merge_sort.rb): set array default value

Co-authored-by: khoaxuantu <68913255+khoaxuantu@users.noreply.github.com>

* feat(codes/ruby/chapter_sorting/merge_sort.rb): driver code add if logic

Co-authored-by: khoaxuantu <68913255+khoaxuantu@users.noreply.github.com>

* feat(codes/ruby/chapter_sorting/merge_sort.rb): modify comment style

Co-authored-by: khoaxuantu <68913255+khoaxuantu@users.noreply.github.com>

* feat(codes/ruby/chapter_sorting/merge_sort.rb): modify logic instruction

Co-authored-by: khoaxuantu <68913255+khoaxuantu@users.noreply.github.com>

---------

Co-authored-by: khoaxuantu <68913255+khoaxuantu@users.noreply.github.com>
2024-04-30 15:58:47 +08:00
3f857db457 feat: add ruby code block - heap sort (#1261)
* feat(codes/ruby/chapter_sorting/heap_sort.rb): add heap_sort ruby file

* feat(codes/ruby/chapter_sorting/heap_sort.rb): modify comment space

* feat(codes/ruby/chapter_sorting/heap_sort.rb): modify code space style

* feat(codes/ruby/chapter_sorting/heap_sort.rb): modify logic instruction

Co-authored-by: khoaxuantu <68913255+khoaxuantu@users.noreply.github.com>

* feat(codes/ruby/chapter_sorting/heap_sort.rb): driver code add if logic

Co-authored-by: khoaxuantu <68913255+khoaxuantu@users.noreply.github.com>

---------

Co-authored-by: khoaxuantu <68913255+khoaxuantu@users.noreply.github.com>
2024-04-30 15:58:37 +08:00
870e3e5cb2 Bug fixes and improvements (#1318)
* Sync zh and zh-hant versions

* Update en/README.md

* Add a Q&A for chapter of introduction

* Update the callout headers

* Sync zh ang zh-hant versions

* Bug fixes
2024-04-30 15:52:05 +08:00
84b1ce2497 Fix incorrect method name in permutations_ii.go (#1313) 2024-04-30 14:13:01 +08:00