157 Commits

Author SHA1 Message Date
Yudong Jin
e6bd76fb75 Update the five translated editions of Hello Algo (#2052)
* Preserve the published Taiwan figure descriptions and homepage as editable sources

* Update the five translated editions of Hello Algo

* Fix reviewed translation, diagram, and example errors across the book

* Correct Korean reader grammar, native diagnostics and example output
2026-11-26 21:37:32 +08:00
Iain
ee0cba022c Fix root deletion in C and Rust binary search trees (#2020)
Co-authored-by: Iain <23277273+NotAFlightRisk@users.noreply.github.com>
2026-11-24 01:26:08 +08:00
Yudong Jin
6d19673be3 Fix demo comments and labels that contradict the code (#2048)
Fix Chinese wording that contradicted the demo code: the C++ std::hash
scope, the Rust node-value hash label, the Go Pop comment and the Go
stack test comment. Russian sources and all six editions' snippets
follow; the Go heap snippets drop the repository-only PrintHeap call.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 21:50:05 +08:00
Yudong Jin
4fd605c502 Correct and unify doc snippets; fix errors in the demo sources (#2039)
Code snippets in the book are corrected and unified across languages and
kept as literal blocks in the snippet files. The demo sources keep their
#2033 form, with fixes only for real errors: wrong code, wrong printed
labels, comments that contradict the code, and typos. en/ja/ko demos are
rendered from the reviewed code dictionaries (krahets/hello-algo-workspace#78).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 15:29:13 +08:00
Yudong Jin
ded7ddc635 Revert the runnable-snippets batches to the #2033 state (#2038)
Reverts #2034, #2035, #2036 and #2037. The work will return in a single
reviewed PR that is completed before it merges. The tree equals 8c96e2f30
(#2033).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-16 06:45:32 +08:00
Yudong Jin
b113cb425a Cite the shared TreeNode for the AVL node and the C binary tree node (#2037)
Batch 3b of the runnable-snippets plan. avl_tree_node now cites each
language's shared TreeNode in all 13 languages, and the C tree_node_class
shares the same region. Rust gets an import region; Java, C#, Swift and
Kotlin skip their serialization helpers with an adjacent region.

The shared nodes gain reviewed field comments in C++ and Rust, aligned
comments in Java, Swift and Kotlin, and a spacing fix in JavaScript. The
AVL section adds one sentence saying the shared node class already has
height. Four ru Rust files whose multi-line statements had collapsed into
literal \n now compile again. en, ja, ko and zh-hant are regenerated; ru
is synced by hand.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-16 05:51:36 +08:00
Yudong Jin
bcd86fc1ed Cite demo-source regions for heap operations and the linked-list node classes (#2036)
Batch 3a of the runnable-snippets plan. heap_operations now cites the heap
demos in Python, C++, Java, C#, Go, Swift, Rust and Kotlin; the demos call
the library directly instead of push/pop helpers and print each popped value.
list_node_class cites each language's shared ListNode (Swift stays literal)
and doubly_list_node_class cites linkedlist_deque (Go stays literal).

Node comments adopt reviewed source wording, Rust and Swift get import
regions, the Ruby typo 前躯 becomes 前驱, and the TypeScript doubly node
fields become nullable. en, ja, ko and zh-hant are regenerated; ru is
synced by hand.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-16 05:23:41 +08:00
Yudong Jin
eeb8a3b790 Cite demo-source regions from the remaining A-class snippets (batch 2) (#2035)
Migrate init_array, hash_map_operations, hash_map_traversal,
queue_operations, deque_operations and insert_remove_node: zh and ru
demo sources gain region markers and the snippets' comments, en, ja and
ko are regenerated from reviewed translations, zh-hant via OpenCC. 70
blocks become region references; builtin_hash and five blocks without
reviewed translations stay literal.

The Java, Kotlin and Rust deque demos follow the book's order, and a few
demo comments and typos are aligned with the snippets.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-16 04:23:45 +08:00
Yudong Jin
849b6a95b9 Cite demo-source regions from doc snippets (pilot) (#2034)
Doc snippets for init_linked_list, init_binary_tree, stack_operations and
five list.md entries now reference marked regions of the demo programs
instead of copying code, so the book shows code that is compiled and run.

- Mark regions in the zh demo files and add the snippet comments that the
  demos lacked, reusing texts that already have reviewed translations.
- Sync ru by hand, regenerate en/ja/ko from the reviewed dictionaries and
  derive zh-hant with OpenCC.
- Convert 97 snippet blocks in six editions to [file]{..}-[region]{..}
  references; init_list and the Rust stack block stay literal until their
  comments have reviewed translations.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-16 03:36:04 +08:00
Yudong Jin
28c1e74c1d Add multilingual exercise code (#1959)
Replace the exercise pages' Python-only snippets with source-backed implementations for the 13 visible programming languages, and localize reader-facing comments by site language. Zig remains out of scope.

Approval bypass: repository protection requires one approval but does not enforce it for administrators. All 68 completed checks succeeded; four non-required Java jobs remained queued on the existing ubuntu-20.04 workflow, with no failed checks.
2026-08-18 04:57:57 +08:00
Yudong Jin
bf86c39b6c Fix multilingual content typos (#1958) 2026-08-18 03:08:23 +08:00
rongyi
0918fd06f2 polish rust (#1790)
* polish graph

* Update graph
2025-08-04 14:45:14 +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
rongyi
bd03b8c66e tiny fix, more readable rust 2025-03-10 17:22:06 +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
rongyi
7503a33e8c fix rust linked list (#1609) 2025-01-14 02:58:17 +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
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
Rui
2758e06374 remove unnecessary type conversions (#1411) 2024-07-14 18:36:00 +08:00
rongyi
017b95f003 Make rust more idomatic (#1386) 2024-06-13 15:19:21 +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
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
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
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
rongyi
56a165bf98 cargo fmt code (#1349) 2024-05-08 18:37:38 +08:00
Yudong Jin
cfc273783b feat: Add glossary and description for "哈希集合" (#1310) 2024-04-28 22:00:25 +08:00
rongyi
a88c7b9862 Change remove to pop (#1309) 2024-04-28 20:47:03 +08:00
rongyi
f901a31bae fix(Rust): no need to clone in hash put fn (#1226)
* no need to clone in hash put fn

* fmt rust code

* make code more readable

* Change vec append to extend, more friendly to rookie rust dev

* drop comment
2024-04-07 14:46:21 +08:00
Yudong Jin
b3f100aff1 Bug fixes and improvements (#1205)
* Add Ruby code blocks to documents

* Remove Ruby code from en/docs

* Remove "center-table" class in index.md

* Add "data-toc-label" to handle the latex heading during the build process

* Use normal JD link instead.

* Bug fixes
2024-04-01 19:37:00 +08:00
Yudong Jin
034ee65e9a Fix bugs and harmonize the code comments (#1199)
* Fix the comment in array_deque.go

* Fix the comment in bucket_sort.c

* Translate the Java code comments to Chinese

* Bug fixes

* 二分查找 -> 二分搜尋

* Harmonize comments in `utils` between multiple programming languages
2024-03-31 03:06:41 +08:00
rongyi
556af1624c No need to match expand pop, just return it (#1154) 2024-03-27 01:29:43 +08:00
Yudong Jin
3ea91bda99 fix: Use int instead of float for the example code of log time complexity (#1164)
* Use int instead of float for the example code of log time complexity

* Bug fixes

* Bug fixes
2024-03-23 02:17:48 +08:00
Nan Lei
300a781fab Update code comment of quadratic in time_complexity (#1155) 2024-03-19 02:28:16 +08:00
Yudong Jin
7f43f92ae9 Bug fixes and improvements (#1152)
* Update avl_tree.md

* Remove the empty space

* Simplify the heading of the paperbook chapter

* Update hash_map_open_addressing.go to the latest version

* Improvements
2024-03-18 13:34:02 +08:00
rongyi
6f1ec66949 Fix rust compile warning and an obvious print error in array.rs (#1144)
* Fix rust compile warning and an obvious print error in array.rs

* Update LinkedList

1. drop unnessaray mut borrow
2. fmt code and make variable more readable

* follow convention of this repo

* Update list_node.rs

---------

Co-authored-by: Yudong Jin <krahets@163.com>
2024-03-18 02:44:03 +08:00
rongyi
7b1094318b cargo fmt rust code (#1131)
* cargo fmt code

* Add empty line to seperate unrelated comments

* Fix review

* Update bubble_sort.rs

* Update merge_sort.rs

---------

Co-authored-by: Yudong Jin <krahets@163.com>
2024-03-16 02:13:41 +08:00
Yudong Jin
9769e14017 Fix the median_three mehod for quick sort (#1134)
* Add the section of terminologies.

* fix format

* Fix median_three function for quick sort

* Delete docs/chapter_appendix/terminologies.md

* Update quick_sort.ts

* Update quick_sort.rs

* Update quick_sort.js
2024-03-15 01:06:59 +08:00
Yudong Jin
01c67781fa Bug fixes and improvements (#1133)
* Bug fixes

* Update the figure of the JD link

* Unify the code comments of insertion_sort
2024-03-14 20:01:16 +08:00
易春风
d4d281cd67 Fix the issue of discussion 514 (#1064) 2024-01-27 19:42:19 +08:00
Yudong Jin
f6976978dd Prepare 1.0.0 release (#1044)
* Update the book with the thrid revised edition

* Fix a typo

* Update the contributors' information

* Update the mindmap

* Update the version number
2024-01-14 03:16:20 +08:00
Yudong Jin
ddd375af20 feat: Add visualizing code blocks based on the pythontutor (#1029)
* Update copyright

* Update the Python code

* Fix the code comments in ArrayBinaryTree

* Fix the code comments in ArrayBinaryTree

* Roll back time_comlexity.py

* Add the visualizing code(pythontutor) blocks to the chapter complexity, data structure, array and linked list, stack and queue, hash table, and backtracking

* Fix the code comments
2024-01-07 04:04:01 +08:00