221 Commits
Author SHA1 Message Date
Yudong JinandClaude Opus 5.5 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 <[email protected]>
2026-11-16 06:45:32 +08:00
Yudong JinandClaude Opus 5.5 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 <[email protected]>
2026-11-16 05:51:36 +08:00
Yudong JinandClaude Opus 5.5 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 <[email protected]>
2026-11-16 05:23:41 +08:00
Yudong JinandClaude Opus 5.5 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 <[email protected]>
2026-11-16 04:23:45 +08:00
Yudong JinandClaude Opus 5.5 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 <[email protected]>
2026-11-16 03:36:04 +08:00
KingCrimsonJY 5b279d48b3 fix: handle single-node pops in linked-list deques (#1824) 2026-10-10 19:18:20 +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
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
sslmj2020 894e3d536b Update array_binary_tree.cpp (#1568)
打印的小错误
2024-11-24 00:39:33 +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
rongyiandYudong Jin 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 <[email protected]>
2024-05-18 18:19:19 +08:00
Yudong Jin 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
Yudong Jin cfc273783b feat: Add glossary and description for "哈希集合" (#1310) 2024-04-28 22:00:25 +08:00
Yudong Jin 78f71eeacb Bug fixes and improvements (#1252)
* Bug fixes

* Fix the landing page of zh-hant version

* Bug fixes and add an Q&A for chapter_data_structure

* Update the mindmap for zh-hant version
2024-04-09 19:55:59 +08:00
cy-by-side d8cae21da3 Fix the driver code of quick_sort.cpp (#1219) 2024-04-04 19:37:18 +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
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 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
Yudong Jin a005c6ebd3 Some improvements (#1073)
* Update avatar's link in the landing page

* Bug fixes

* Move assets folder from overrides to docs

* Reduce figures' corner radius

* Update copyright

* Update header image

* Krahets -> krahets

* Update the landing page
2024-02-07 22:21:18 +08:00
Scai 84f4b8d285 fix: Update linkedlist_deque.cpp (#1062)
There is something error when delete node, should 'delete front' or 'delete rear' outside the body of if cycle.
2024-01-25 12:51:17 +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
th1nk3r-ing d06503b50b fix(cpp): cmake compile my_list.cpp for target list (#1025) 2024-01-05 17:29:53 +08:00
Yudong Jin f68bbb0d59 Update the book based on the revised second edition (#1014)
* Revised the book

* Update the book with the second revised edition

* Revise base on the manuscript of the first edition
2023-12-28 18:06:09 +08:00
krahets 9a5ab776d6 A bug fix. 2023-12-19 21:55:57 +08:00
Yudong Jin e720aa2d24 feat: Revised the book (#978)
* Sync recent changes to the revised Word.

* Revised the preface chapter

* Revised the introduction chapter

* Revised the computation complexity chapter

* Revised the chapter data structure

* Revised the chapter array and linked list

* Revised the chapter stack and queue

* Revised the chapter hashing

* Revised the chapter tree

* Revised the chapter heap

* Revised the chapter graph

* Revised the chapter searching

* Reivised the sorting chapter

* Revised the divide and conquer chapter

* Revised the chapter backtacking

* Revised the DP chapter

* Revised the greedy chapter

* Revised the appendix chapter

* Revised the preface chapter doubly

* Revised the figures
2023-12-02 06:21:34 +08:00
Yudong Jin f7c41b6bef fix: Update C code for compatibility with the MSVC compiler (#949)
* Replace VLA with malloc
Replace VLA with malloc to make C code
compatible with cl compiler on Windows.

* Fix C code for CI compiler.

* Fix C code compability to CI.

* check the trigger
2023-11-17 00:29:54 +08:00
Yudong Jin fcbaf101a4 Several bug fixes and improvements (#945)
* Update Dockerfile for code debugging.

* Format Python code using Black.

* Improve dark theme by defining html classes for the figures, animations and cover images.

* Fix several glossary translation.

* Update a code comment.

* Fix climbing_stairs_backtrack: the pruning should not require the sorted choices list.

* Update the code of array and list traversal.

* Fix a rendering issue of README.md

* Update code of list traversal.

* Fix array_definition.png

* Update README.md

* Fix max_capacity_moving_short_board.png

* Fix array.dart

* Fix array.dart

* Fix array.dart

* Fix array.dart
2023-11-14 21:27:35 +08:00
krahets 5f3ad1ed3d A few bug fixes. 2023-11-03 22:48:43 +08:00
krahets 355cc3a6b1 Bug fixes to C code. 2023-11-01 05:14:22 +08:00
krahets 5b1a219b8b Fine-tune code and texts. 2023-10-27 01:01:21 +08:00
Yudong Jin e441ee4e35 Re-implement merge sort function. (#888) 2023-10-26 02:56:33 +08:00
Yudong Jin 7822bf9cd4 feat: add top_k.c and refactor top_k.js (#889)
* Add top_k.c based on my_heap.c

* Improve the implementation of top_k.js

* Add a comment to top_k
2023-10-26 02:54:19 +08:00
52coderandYudong Jin 436b6fa9a6 Add C++ iterator example for C++ (#837)
* 增加c++迭代器访问示例

* Update hash_map.md

* Update hash_map.cpp

---------

Co-authored-by: Yudong Jin <[email protected]>
2023-10-24 23:59:10 +08:00
krahets 5392afd44b fix several bugs 2023-10-17 23:45:31 +08:00
krahets a8c624fa5a Fix the code in min_path_sum 2023-10-14 03:25:11 +08:00
krahets fb552987f5 Update variable names in list and my_list 2023-10-09 18:20:42 +08:00
krahets 4355f8d49f Several bug fixes. 2023-10-04 02:30:31 +08:00
FlamingoandYudong Jin 22be495412 fix(cpp). update hash_map (#800)
* fix(cpp). update hash_map

遍历 map 还是 k-v 键值对

* Update hash_map.md

---------

Co-authored-by: Yudong Jin <[email protected]>
2023-09-25 22:07:14 -05:00
krahets ff8e7ceec5 Several bug fixes. 2023-09-24 20:38:21 +08:00
krahets e3773b7f76 Several bug fixes and improments. 2023-09-24 19:35:32 +08:00
Yudong Jin a46b482951 Refactor the hash_map_open_addressing implementation with lazy reallocation. (#776) 2023-09-21 04:43:15 -05:00
krahets 8effa58a59 Several bug fixes. 2023-09-20 01:53:44 +08:00
krahets 9f59c572b5 fine tune 2023-09-17 01:13:15 +08:00
krahets cb9c14f5ff fix build_tree, binary_search_tree.cs
fix two figures
2023-09-15 02:08:09 +08:00
krahets d190dbf3c1 Several enhancements and fixes 2023-09-14 03:36:31 +08:00
krahets 5f814d6538 Add comparison between iteration and recursion.
Fix the figure of tail recursion.
Fix two links.
2023-09-12 00:56:59 +08:00