Commit Graph

2134 Commits

Author SHA1 Message Date
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
Yudong Jin
45e1295241 Revisit the English version (#1835)
* Review the English version using Claude-4.5.

* Update mkdocs.yml

* Align the section titles.

* Bug fixes
2025-12-30 17:54:01 +08:00
O
091afd38b4 add epub generator (#1831)
* add epub generator

* improve parser, keep images

* check epub after generate

* fix render math content error in block

* render \dots as ...

* render \lfoor and \rfloor

* use monospaced font to render code block

* render code block with syntax highlight

* adjust title render

* fix render LaTeX

* fix '!!! abstract' render

* render code block in flow

* include whole class when not specifiy function

* command line to build other language

* update README

* fix process python code example

* support build en, ja and zh-hant

* add '--all' option to build all version

* use branch docs to build epub

* fix title and toc render

* build epub file with name like 'hello-algo_{zh}_{cpp}.epub

* fix render LaTeX

* optimize style

* use math font

* fix extract code block

* add border for code block

* fix python code style

* fix page break

* try git pull first when build epub

* ajust title level of chapter section

* Update epub styles

* Update epub styles

* Update convers and fonts.

* Convert code comments and README into English.

* Update the output dir.

* Add code reviewers on the cover.

* Support multi language for the reviewer names.

* Update .gitignore

---------

Co-authored-by: krahets <krahets@163.com>
2025-12-30 08:23:31 +08:00
Yudong Jin
2db8f741a8 Add starfield.js in the landing page. (#1833) 2025-12-27 05:33:45 +08:00
Shyam Chen
da230312cd ci: run CI with Node.js v24 (LTS) (#1822) 2025-10-30 20:27:41 +08:00
Yudong Jin
6cdc5ca0e4 Update ja/README (#1819)
* Update ja/README

* Update ja/README

* Update README.md
2025-10-17 05:28:31 +08:00
Ikko Eltociear Ashimine
954c45864b docs: add Japanese translate documents (#1812)
* docs: add Japanese documents (`ja/docs`)

* docs: add Japanese documents (`ja/codes`)

* docs: add Japanese documents

* Remove pythontutor blocks in ja/

* Add an empty at the end of each markdown file.

* Add the missing figures (use the English version temporarily).

* Add index.md for Japanese version.

* Add index.html for Japanese version.

* Add missing index.assets

* Fix backtracking_algorithm.md for Japanese version.

* Add avatar_eltociear.jpg. Fix image links on the Japanese landing page.

* Add the Japanese banner.

---------

Co-authored-by: krahets <krahets@163.com>
2025-10-17 05:04:43 +08:00
Yudong Jin
2487a27036 Update the Warp link. (#1815)
* Bug fixes.

* Update the Warp link.
2025-09-24 02:37:59 +08:00
Yudong Jin
44effb07e6 Bug fixes and improvements (#1813)
* Sync zh and zh-hant version.

* Add the Warp sponsor banner.

* Update README with acknowledgments and Warp recommendation

Added acknowledgments and a recommendation for the Warp terminal application.

* Update README.md

* Update links in README.md to use HTTPS

* Sync zh and zh-hant versions.

* Add special thanks for Warp spnsorship.

* Use official warp image link.
2025-09-23 20:44:38 +08:00
Siz Long
790a6d17e1 Update Q&A of hash_table and time_complexity Chapter (#1760)
* Update summary.md

@Richard-Zhao93 的回答非常好,同时觉得"如果在开头能了解到这部分s,对初学者来说,可能更容易接受这些陌生的概念。"的建议很有道理

* Update QA of time_complexity

* Enhance explanation of hash tables vs arrays

Clarify the advantages of hash tables over arrays for key-value mapping.

* Update summary.md

---------

Co-authored-by: Yudong Jin <krahets@163.com>
2025-09-20 19:52:59 +08:00
Beatrix CHAN
32dde5f82f translation: Update chapter_data_structure/classification_of_data_structure.md (#1800)
* Update classification_of_data_structure.md

* Update classification_of_data_structure.md

* Fix punctuation and formatting in data structure chapter

---------

Co-authored-by: Yudong Jin <krahets@163.com>
2025-09-20 19:27:46 +08:00
sunshinesDL
a69b5ef93b Update hash_map.md (#1802)
* Update hash_map.md

对目标句子的表达略微修改,使得前后句子的语义更加一致。

* Fix wording for bucket index calculation

---------

Co-authored-by: Yudong Jin <krahets@163.com>
2025-09-20 19:26:04 +08:00
sunshinesDL
218e21e800 Update stack.md (#1788)
* Update stack.md

K大好,小白建议在这句话前面增加一个条件 -- "每次只能移动一个盘子",如此不仅可以对应后面的 `将上面的盘子**依次**移走`,从而避免了 "可以将上面的盘子一次移走" 的歧义;而且对应了每次移除一个元素的出栈逻辑。

* Refine explanation of stack data structure

Corrected phrasing for clarity in stack explanation.

---------

Co-authored-by: Yudong Jin <krahets@163.com>
2025-09-20 19:18:35 +08:00
PXG-XPG
909b89680f fix: correct String.format() parameter passing error in climbing_stairs_*.java (#1807) 2025-09-20 19:11:51 +08:00
sunshinesDL
1e6a84119a Update array_hash_map.py (#1803)
基于数组实现的哈希表中,`get()` 函数的返回值还可能会 None;且 `put()` 函数不仅可添加键值对、还可更新表中已有键值对的值;
2025-09-20 19:09:03 +08:00
PXG-XPG
3709a97ca7 Update dp_solution_pipeline.md (#1806)
错别字
2025-09-11 01:53:37 +08:00
Yudong Jin
7b320e14fe Sync zh and zh-hant versions (#1801)
* Sync zh and zh-hant versions.

* Unifying "数据体量" -> "数据规模".
2025-08-28 04:51:02 +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
sunshinesDL
5c085b5592 Update performance_evaluation.md (#1770)
* Update performance_evaluation.md

**修改内容:**
把本节使用的 “输入数据大小” 统一修改为 “输入数据规模”。

**修改原因:**
今天在分析一个函数的复杂度时回看本节,发现这处表述好像存在歧义。阅读本节内容可知,复杂度分析实际是分析算法的运行时间和空间占用与数据规模的关系。 从字面理解,“输入数据的大小” 更像指输入数据的数值大小,而非数据规模。虽然多数场景下,输入数据的数值大小可以通过迭代/递归反映数据规模,但在个别场景下并非如此,如 5.1.2 节 "基于链表实现的栈" 中的 `to_list() `函数:
```python
 def to_list(self) -> list[int]:
        """转化为列表用于打印"""
        arr = []
        node = self._peek
        while node:
            arr.append(node.val)
            node = node.next
        arr.reverse()
        return arr
```
该函数无形参,其时间复杂度实际指,函数运行时间随着栈中数据数量的增加而呈现的增长趋势,而非随栈中数据数值大小的增加呈现的增长趋势。 因此,为规避歧义,小白提议将本节的“输入数据大小” 改为 “输入数据规模”。

然而,一百个读者有一百个哈姆雷特,或许其他读者读到这里未感觉歧义,且本章后续章节还有多处使用这一表述,若本节修改可能后面也需与其保持统一。或许也可以在本章2.1节插入一个Tip约定这一表述的实际意义。考虑不周,欢迎 K大及评阅大佬指正!

* Update performance_evaluation.md

---------

Co-authored-by: Yudong Jin <krahets@163.com>
2025-07-20 19:56:15 +08:00
sunshinesDL
ee4d27dc17 Update time_complexity.md (#1772)
* Update time_complexity.md

对于多项式函数 c * f(n), 系数 c 好像不能称为常数项,遂查阅《算法导论 第三版》相关章节,在其 26 页使用了常量因子这一表述,该表述好像晦涩了些,小白提议这里将 ”常数项“ 改为 ”常数“。 
欢迎 K大及评阅大佬指正!

* Update time_complexity.md

---------

Co-authored-by: Yudong Jin <krahets@163.com>
2025-07-10 07:08:44 +08:00
Beatrix CHAN
301adcf416 translation: Update algorithms_are_everywhere.md (#1733)
* Improve English Translation for algorithms_are_everywhere.md

* Fixed line 5, 7, 10

* Keep initial alt text for binary search demonstration

* Update Example 3 English translation

* Update algorithms_are_everywhere.md

* Update algorithms_are_everywhere.md

---------

Co-authored-by: Yudong Jin <krahets@163.com>
2025-07-10 06:54:30 +08:00
Magenta Qin
f47d371035 translation: Update EN translation for Introduction Chapter (#1739)
* doc: update en translation of algorithm_are_everywhere

* doc: update en translation of what_is_dsa

* doc: update en translation of summary

* feat: en translation for Q&A

* doc: update en translation to make it more concise

* Update algorithms_are_everywhere.md

---------

Co-authored-by: Yudong Jin <krahets@163.com>
2025-07-10 06:38:30 +08:00
Magenta Qin
e058e14253 translation: Update en translation for preface (#1738)
* doc: update en translation for preface

* doc: fix blank line and other typos

* doc: fix period
2025-07-10 06:36:16 +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
sunshinesDL
6a4d62449c Update max_product_cutting_problem.md (#1758)
* Update max_product_cutting_problem.md

本节结尾的正确性证明中,

"使用反证法,只分析 n >= 3 的情况。"

这句是否应该改为 “只分析 n >= 4 的情况”,因为 n == 3 时,由于题目要求至少将 n 切分为两个正整数,所以此时应该切分为 1 * 2 ,切分方案里是包含 1 的 😁;
此外,对于这句描述:

“假设最优切分方案中存在 >= 4 的因子 x ,那么一定可以将其继续划分为 2(x-2) ,从而获得更大的乘积。”

最后半句改为“从而获得更大或可替代的乘积”是否更好,因为当切分方案中存在 4 作为因子时,将其划分为 2 * 2,乘积相对划分前是相等的。不过这处改动不影响“所有因子 <= 3” 的结论,因为因子 4 是可以被替代的。

* Update max_product_cutting_problem.md

---------

Co-authored-by: Yudong Jin <krahets@163.com>
2025-06-12 21:10:15 +08:00
Dr.XYZ
ceec0eaa3a Specify currency unit in the "Price" row of the storage compar… (#1755)
* Specify currency unit as CNY in the "Price" row of the storage comparison table

* Revert changes to the English version

* Change currency unit to USD

* fix

* fix space

* Update ram_and_cache.md

---------

Co-authored-by: Yudong Jin <krahets@163.com>
2025-06-12 20:57:47 +08:00
rongyi
7751ea1256 update rust heap (#1761) 2025-06-12 20:47:47 +08:00
Seven Du
5a4aa8c554 en: fix picture file name (#1764) 2025-06-12 20:46:31 +08:00
Yudong Jin
db64108e5d Bug fixes (#1766)
* Sync zh and zh-hant versions.

* Bug fixes.
2025-06-12 20:45:41 +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
Seren
e79a56f540 Update Zig example code (#1737) 2025-05-17 17:15:30 +08:00
UMER JAHANGIR
e4f5787685 Translation: Update intro_to_dynamic_programming.md (#1751)
* Update intro_to_dynamic_programming.md

* Update intro_to_dynamic_programming.md

Made corrections and improvements to the introduction of dynamic programming based on reviewer suggestions.

* Update intro_to_dynamic_programming.md

Again, I made corrections and improvements to the introduction of dynamic programming based on reviewer suggestions.

* Update intro_to_dynamic_programming.md

chore: corrected missed feedback/suggestion from review
2025-05-17 17:14:43 +08:00
趙子賢
3ad70167db Fix typo in Traditional Chinese translation of binary search (#1750)
線上性查詢 -> 線性查詢
2025-05-17 17:14:32 +08:00
Yudong Jin
f9d37e0d16 Update en/README. Bug fixes. (#1742)
* Fix graph_operations.md

* Update README

* Sync zh and zh-hant versions.
2025-04-27 16:56:24 +08:00
Yudong Jin
1904bb8afc Add origins in giscus.json. Update en/README.md. (#1740)
* Fix the definition of "complete binary tree" in binary_tree.md

* Update en/README.md

* Add origins in giscus.json
2025-04-27 16:07:22 +08:00
Colin Penn
e1f0903bf7 translation: Update n_queens_problem.md (#1676)
* Update n_queens_problem.md

* translation: Update n_queens_problem.md
2025-04-26 00:47:07 +08:00
Colin Penn
cc0852fae8 translation: update chapter_backtracking/summary.md (#1671)
* update chapter_backtracking/summary.md

* translation: update chapter_backtracking/summary.md

* translation: update chapter_backtracking/summary.md
2025-04-26 00:46:10 +08:00
Thomas
9997c2822c translation: backtracking algorithm (#1669)
* translation: backtracking algorithm

* resolve comments
2025-04-26 00:45:01 +08:00
Yudong Jin
d976116292 Bug fixes and improvements (#1735)
* Fix the definition of "complete binary tree" in binary_tree.md

* Update en/README.md
2025-04-15 16:57:31 +08:00
Yudong Jin
8e38c61455 Bug fixes and improvements (#1732)
* Bug fixes

* Sync zh and zh-hant versions.

* "入列列" -> "入佇列"

* Fix hello_algo_mindmap.png
2025-04-10 19:21:52 +08:00
Ian Chiu
a9d44c3a25 fix(zh-hant translation): graph_traversal.md (#1711)
* 修正 graph_traversal.md 繁體中文版錯誤的文字

`列列` -> `隊列`

* Update graph_traversal.md

---------

Co-authored-by: Yudong Jin <krahets@163.com>
2025-03-28 17:09:29 +08:00
Sizhe Fan
3177d35eb2 Update the description of time and space complexity of fractional_knapsack problem. (#1688)
* 优化分数背包的部分复杂度描述,使其更加严谨

* Update fractional_knapsack_problem.md

---------

Co-authored-by: Yudong Jin <krahets@163.com>
2025-03-20 19:46:17 +08:00
Phoenix Xie
1db2001e9b tanslation: Update chapter_backtracking / permutations_problem.md (#1664)
* tanslation: Update chapter_backtracking / permutations_problem.md

* Update permutations_problem.md

* Update permutations_problem.md

* Update permutations_problem.md

* Update permutations_problem.md

* Update permutations_problem.md
2025-03-14 17:56:41 +08:00
Yudong Jin
0a3d3940c4 Merge pull request #1681 from rongyi/main
tiny fix, more readable rust
2025-03-11 16:56:33 +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