1232 Commits

Author SHA1 Message Date
Kunchen-Luo c2eb1dbc5a Fix confusion between queSize and rear pointer in ArrayQueue implementation (#1851)
- `queSize` represents the queue's size, not the rear pointer position.
- In `pop`, `queSize--` decreases the size, not the rear pointer.
- The rear pointer is calculated using modulo (`%`) with the `front` and `queSize` to avoid confusion.

Co-authored-by: Chance Luo <247349913+chanceluo1618-bot@users.noreply.github.com>
2026-03-30 14:46:56 +08:00
Yudong Jin 2778a6f9c7 Translate all code to English (#1836)
* Review the EN heading format.

* Fix pythontutor headings.

* Fix pythontutor headings.

* bug fixes

* Fix headings in **/summary.md

* Revisit the CN-to-EN translation for Python code using Claude-4.5

* Revisit the CN-to-EN translation for Java code using Claude-4.5

* Revisit the CN-to-EN translation for Cpp code using Claude-4.5.

* Fix the dictionary.

* Fix cpp code translation for the multipart strings.

* Translate Go code to English.

* Update workflows to test EN code.

* Add EN translation for C.

* Add EN translation for CSharp.

* Add EN translation for Swift.

* Trigger the CI check.

* Revert.

* Update en/hash_map.md

* Add the EN version of Dart code.

* Add the EN version of Kotlin code.

* Add missing code files.

* Add the EN version of JavaScript code.

* Add the EN version of TypeScript code.

* Fix the workflows.

* Add the EN version of Ruby code.

* Add the EN version of Rust code.

* Update the CI check for the English version  code.

* Update Python CI check.

* Fix cmakelists for en/C code.

* Fix Ruby comments
2025-12-31 07:44:52 +08:00
Shyam Chen da230312cd ci: run CI with Node.js v24 (LTS) (#1822) 2025-10-30 20:27:41 +08:00
sunshinesDL 1e6a84119a Update array_hash_map.py (#1803)
基于数组实现的哈希表中,`get()` 函数的返回值还可能会 None;且 `put()` 函数不仅可添加键值对、还可更新表中已有键值对的值;
2025-09-20 19:09:03 +08:00
MetaSky 803c0e09c7 code: update zig 0.14.1 for the chapter of array_and_linkedlist and computational_complexity (#1787)
* update zig array list chapter

* update not need change codes.

* fix some pr issues and update time space chapter
2025-08-06 02:33:00 +08:00
rongyi 0918fd06f2 polish rust (#1790)
* polish graph

* Update graph
2025-08-04 14:45:14 +08:00
WuJing 83a806a602 greedy/max_capacity: fix myMax algorithm error (#1784)
Co-authored-by: wujing <realwujing@qq.com>
2025-07-21 15:12:34 +08:00
rongyi b0c147b67c Polish rust (#1777)
* Polish rust

* Update array queue and linkedlist queue

* Update linkedlist deque

* make array deque generic
2025-07-10 06:33:22 +08:00
Yudong Jin e8dc4736a2 Bug fixes and improvements. (#1780)
* Fix the "尾递归优化" to "递归深度优化" in quick_sort.

* Update landing pages.

* Sync zh and zh-hant versions.

* Sync zh and zh-hant versions.
2025-07-10 06:32:25 +08:00
rongyi 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
Asashishi_Nyan! 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
rongyi bd03b8c66e tiny fix, more readable rust 2025-03-10 17:22:06 +08:00
Red Wood 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
AsaoOoo0o0o 98cd3a8076 fix: update the implementation of simple_hash.js and .ts (#1656) 2025-02-25 04:54:48 +08:00
rongyi 00738f5bb4 idomatic rust (#1652)
* idomatic rust

* Update linkedlist queue/deque
2025-02-10 10:40:29 +08:00
Frost Wong 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
rongyi 7503a33e8c fix rust linked list (#1609) 2025-01-14 02:58:17 +08:00
Flamingo 292b107af2 fix(bubble-sort): update incorrect variable name in test output (#1595) 2024-12-20 17:15:22 +08:00
pzpz 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
sslmj2020 894e3d536b Update array_binary_tree.cpp (#1568)
打印的小错误
2024-11-24 00:39:33 +08:00
Fleey 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
Flamingo 57cf6b1ea6 fix some typos (#1540) 2024-10-31 21:26:28 +08:00
hpstory b3b10f2300 fix(csharp): priority queue comparer initialization (#1542) 2024-10-31 21:25:32 +08:00
rongyi 68a61f23d5 make dfs same as c/c++ and other small improvement (#1543) 2024-10-31 21:24:56 +08:00
rongyi ef3010bd77 idomatic structure rust code, no include macro (#1528) 2024-10-23 18:49:47 +08:00
bongbongbakudan c12d01a752 Update my_list.js (#1511)
修改insert注释
2024-09-24 17:57:34 +08:00
rongyi 7a345fc66b Idiomatic rust (#1505) 2024-09-12 17:38:16 +08:00
Risun 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
rongyi 8a6ce26f6a idiomatic rust (#1485)
* idomatic rust

* More idiomatic rust

* make rust code more idiomatic

* update
2024-08-23 02:33:47 +08:00
ZhongYuuu 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
Flamingo 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
rongyi 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
Yudong Jin 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
khoaxuantu a14be17b74 [feat] add ruby code - chapter dynamic programming (#1378) 2024-05-30 17:11:56 +08:00
rongyi 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
khoaxuantu 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
rongyi 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
Lanjing Gong 0e221540a3 fix(c): Fix malloc allocation of secondary pointers can lead to dump issues (#1367) 2024-05-18 18:17:33 +08:00
CarrotDLaw 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
rongyi 840692acce Idiomatic rust (#1364) 2024-05-15 18:16:55 +08:00
khoaxuantu 9e569cf520 feat: add ruby code - chapter "divide and conquer" (#1361) 2024-05-15 18:14:15 +08:00
rongyi 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
rongyi ebff1cce9f Stick with swap (#1352) 2024-05-11 17:59:44 +08:00
rongyi 7a96f6a743 Fix panic when array's len is less than 2 (#1353) 2024-05-11 17:59:11 +08:00
khoaxuantu 1f606d6852 feat: add ruby codes - chapter greedy (#1350) 2024-05-08 18:38:35 +08:00
rongyi 56a165bf98 cargo fmt code (#1349) 2024-05-08 18:37:38 +08:00