diff --git a/.gitignore b/.gitignore index 75f842855..190a18d75 100644 --- a/.gitignore +++ b/.gitignore @@ -15,8 +15,3 @@ # test script test.sh - -# overrides -overrides/partials/* -!overrides/partials/content.html -!overrides/partials/footer.html diff --git a/docs/chapter_appendix/installation.assets/vscode_extension_installation.png b/docs/chapter_appendix/installation.assets/vscode_extension_installation.png new file mode 100644 index 000000000..0efab8178 Binary files /dev/null and b/docs/chapter_appendix/installation.assets/vscode_extension_installation.png differ diff --git a/docs/chapter_appendix/installation.assets/vscode_installation.png b/docs/chapter_appendix/installation.assets/vscode_installation.png new file mode 100644 index 000000000..87f28b8bb Binary files /dev/null and b/docs/chapter_appendix/installation.assets/vscode_installation.png differ diff --git a/docs/chapter_appendix/installation.md b/docs/chapter_appendix/installation.md index 8427a95b4..34e84fb84 100644 --- a/docs/chapter_appendix/installation.md +++ b/docs/chapter_appendix/installation.md @@ -1,19 +1,16 @@ # 编程环境安装 -### VSCode +## 安装 IDE -本书推荐使用开源、轻量的 VSCode 作为本地 IDE ,下载并安装 [VSCode](https://code.visualstudio.com/) 。 +推荐使用开源、轻量的 VSCode 作为本地集成开发环境(IDE)。访问 [VSCode 官网](https://code.visualstudio.com/),根据操作系统选择相应版本的 VSCode 进行下载和安装。 -### Java 环境 +![从官网下载 VSCode](installation.assets/vscode_installation.png) -1. 下载并安装 [OpenJDK](https://jdk.java.net/18/)(版本需满足 > JDK 9)。 -2. 在 VSCode 的插件市场中搜索 `java` ,安装 Extension Pack for Java 。 +VSCode 拥有强大的扩展包生态系统,支持大多数编程语言的运行和调试。以 Python 为例,安装“Python Extension Pack”扩展包之后,即可进行 Python 代码调试。安装步骤如下图所示。 -### C/C++ 环境 +![安装 VSCode 扩展包](installation.assets/vscode_extension_installation.png) -1. Windows 系统需要安装 [MinGW](https://sourceforge.net/projects/mingw-w64/files/)([配置教程](https://blog.csdn.net/qq_33698226/article/details/129031241));MacOS 自带 Clang ,无须安装。 -2. 在 VSCode 的插件市场中搜索 `c++` ,安装 C/C++ Extension Pack 。 -3. (可选)打开 Settings 页面,搜索 `Clang_format_fallback Style` 代码格式化选项,设置为 `{ BasedOnStyle: Microsoft, BreakBeforeBraces: Attach }` 。 +## 安装语言环境 ### Python 环境 @@ -21,17 +18,16 @@ 2. 在 VSCode 的插件市场中搜索 `python` ,安装 Python Extension Pack 。 3. (可选)在命令行输入 `pip install black` ,安装代码格式化工具。 -### Go 环境 +### C/C++ 环境 -1. 下载并安装 [go](https://go.dev/dl/) 。 -2. 在 VSCode 的插件市场中搜索 `go` ,安装 Go 。 -3. 按快捷键 `Ctrl + Shift + P` 呼出命令栏,输入 go ,选择 `Go: Install/Update Tools` ,全部勾选并安装即可。 +1. Windows 系统需要安装 [MinGW](https://sourceforge.net/projects/mingw-w64/files/)([配置教程](https://blog.csdn.net/qq_33698226/article/details/129031241));MacOS 自带 Clang ,无须安装。 +2. 在 VSCode 的插件市场中搜索 `c++` ,安装 C/C++ Extension Pack 。 +3. (可选)打开 Settings 页面,搜索 `Clang_format_fallback Style` 代码格式化选项,设置为 `{ BasedOnStyle: Microsoft, BreakBeforeBraces: Attach }` 。 -### JavaScript 环境 +### Java 环境 -1. 下载并安装 [node.js](https://nodejs.org/en/) 。 -2. 在 VSCode 的插件市场中搜索 `javascript` ,安装 JavaScript (ES6) code snippets 。 -3. (可选)在 VSCode 的插件市场中搜索 `Prettier` ,安装代码格式化工具。 +1. 下载并安装 [OpenJDK](https://jdk.java.net/18/)(版本需满足 > JDK 9)。 +2. 在 VSCode 的插件市场中搜索 `java` ,安装 Extension Pack for Java 。 ### C# 环境 @@ -39,11 +35,23 @@ 2. 在 VSCode 的插件市场中搜索 `C# Dev Kit` ,安装 C# Dev Kit ([配置教程](https://code.visualstudio.com/docs/csharp/get-started))。 3. 也可使用 Visual Studio([安装教程](https://learn.microsoft.com/zh-cn/visualstudio/install/install-visual-studio?view=vs-2022))。 +### Go 环境 + +1. 下载并安装 [go](https://go.dev/dl/) 。 +2. 在 VSCode 的插件市场中搜索 `go` ,安装 Go 。 +3. 按快捷键 `Ctrl + Shift + P` 呼出命令栏,输入 go ,选择 `Go: Install/Update Tools` ,全部勾选并安装即可。 + ### Swift 环境 1. 下载并安装 [Swift](https://www.swift.org/download/) 。 2. 在 VSCode 的插件市场中搜索 `swift` ,安装 [Swift for Visual Studio Code](https://marketplace.visualstudio.com/items?itemName=sswg.swift-lang) 。 +### JavaScript 环境 + +1. 下载并安装 [node.js](https://nodejs.org/en/) 。 +2. 在 VSCode 的插件市场中搜索 `javascript` ,安装 JavaScript (ES6) code snippets 。 +3. (可选)在 VSCode 的插件市场中搜索 `Prettier` ,安装代码格式化工具。 + ### Dart 环境 1. 下载并安装 [Dart](https://dart.dev/get-dart) 。 diff --git a/docs/chapter_array_and_linkedlist/ram_and_cache.assets/storage_pyramid.png b/docs/chapter_array_and_linkedlist/ram_and_cache.assets/storage_pyramid.png index 4a14715f6..354d2d4b6 100644 Binary files a/docs/chapter_array_and_linkedlist/ram_and_cache.assets/storage_pyramid.png and b/docs/chapter_array_and_linkedlist/ram_and_cache.assets/storage_pyramid.png differ diff --git a/docs/index.assets/btn_download_pdf.svg b/docs/index.assets/btn_download_pdf.svg index 7670e9170..9dd5d2a16 100644 --- a/docs/index.assets/btn_download_pdf.svg +++ b/docs/index.assets/btn_download_pdf.svg @@ -1 +1 @@ -下载PDF \ No newline at end of file +下载PDF \ No newline at end of file diff --git a/docs/index.assets/btn_download_pdf_dark.svg b/docs/index.assets/btn_download_pdf_dark.svg index b8e165659..f3891559a 100644 --- a/docs/index.assets/btn_download_pdf_dark.svg +++ b/docs/index.assets/btn_download_pdf_dark.svg @@ -1 +1 @@ -下载PDF \ No newline at end of file +下载PDF \ No newline at end of file diff --git a/docs/index.assets/btn_read_online.svg b/docs/index.assets/btn_read_online.svg index e4c210e42..2c380c09f 100644 --- a/docs/index.assets/btn_read_online.svg +++ b/docs/index.assets/btn_read_online.svg @@ -1 +1 @@ -在线阅读 \ No newline at end of file +在线阅读 \ No newline at end of file diff --git a/docs/index.assets/btn_read_online_dark.svg b/docs/index.assets/btn_read_online_dark.svg index 4fcb886ee..fcf0ee78c 100644 --- a/docs/index.assets/btn_read_online_dark.svg +++ b/docs/index.assets/btn_read_online_dark.svg @@ -1 +1 @@ -在线阅读 \ No newline at end of file +在线阅读 \ No newline at end of file diff --git a/docs/index.md b/docs/index.md index 06592fdcb..80e7bdf3a 100644 --- a/docs/index.md +++ b/docs/index.md @@ -3,18 +3,18 @@ comments: true glightbox: false hide: - footer + - toc + - edit --- -

- -

- - -

+
+ + +
-

《 Hello 算法 》

+

《 Hello 算法 》

-

动画图解、一键运行的数据结构与算法教程

+

动画图解、一键运行的数据结构与算法教程

@@ -30,6 +30,21 @@ hide:

+

+ + + 开始阅读 + + + + 下载代码 + + + + 下载 PDF + +

+

@@ -50,56 +65,68 @@ hide:

推荐语

-!!! quote - - “一本通俗易懂的数据结构与算法入门书,引导读者手脑并用地学习,强烈推荐算法初学者阅读。” - - **—— 邓俊辉,清华大学计算机系教授** - -!!! quote - - “如果我当年学数据结构与算法的时候有《Hello 算法》,学起来应该会简单 10 倍!” - - **—— 李沐,亚马逊资深首席科学家** - ---- - -

全书动画图解

- -

内容清晰易懂、学习曲线平滑
电脑、平板、手机全终端阅读

- - - -!!! quote "" - -

"A picture is worth a thousand words."

-

“一图胜千言”

+
+
+

Quote

+

“一本通俗易懂的数据结构与算法入门书,引导读者手脑并用地学习,强烈推荐算法初学者阅读。”

+

—— 邓俊辉,清华大学计算机系教授

+
+
+

Quote

+

“如果我当年学数据结构与算法的时候有《Hello 算法》,学起来应该会简单 10 倍!”

+

—— 李沐,亚马逊资深首席科学家

+
+
--- -

代码一键运行

- -

提供各个算法与数据结构的简洁实现与测试样例,皆可直接运行
支持 Python、C++、Java、C#、Go、Swift、JS、TS、Dart、Rust、C、Zig 等语言

- - - -!!! quote "" - -

"Talk is cheap. Show me the code."

-

“少吹牛,看代码”

- ---- +
+
+
+

动画图解

+ +
+

内容清晰易懂
学习曲线平滑

+
+ +
-

可讨论与提问

+
+

"A picture is worth a thousand words."

+

“一图胜千言”

+
-

鼓励小伙伴们互帮互助、共同成长
提问与评论一般能在两日内得到回复

+
+ +
+
+

一键运行

+ +
+

十余种编程语言
代码可直接运行

+
+
- +
+

"Talk is cheap. Show me the code."

+

“少吹牛,看代码”

+
-!!! quote "" +
+
+
+

互助学习

+ +
+

欢迎讨论与提问
读者间携手共进

+
+ +
-

“追风赶月莫停留,平芜尽处是春山”

-

一起加油!

+
+

"追风赶月莫停留"

+

“平芜尽处是春山”

+
--- @@ -115,7 +142,7 @@ hide:

作者简介

-靳宇栋 ([Krahets](https://leetcode.cn/u/jyd/)),大厂高级算法工程师,上海交通大学硕士。力扣(LeetCode)全网阅读量最高博主,发表的[《图解算法数据结构》](https://leetcode.cn/leetbook/detail/illustration-of-algorithm/)已被订阅 27 万本。 +靳宇栋 ([Krahets](https://leetcode.cn/u/jyd/)),大厂高级算法工程师,上海交通大学硕士。力扣(LeetCode)全网阅读量最高博主,发表的[《图解算法数据结构》](https://leetcode.cn/leetbook/detail/illustration-of-algorithm/)已被订阅 30 万本。 --- @@ -125,7 +152,7 @@ hide:

- +

@@ -134,15 +161,15 @@ hide:
- - - - - - - - - + + + + + + + + +
Gonglja
Gonglja

C, C++
gvenusleo
gvenusleo

Dart
hpstory
hpstory

C#
justin-tse
justin-tse

JS, TS
krahets
krahets

Java, Python
night-cruise
night-cruise

Rust
nuomi1
nuomi1

Swift
Reanon
Reanon

Go, C
sjinzh
sjinzh

Rust, Zig
Gonglja
Gonglja

C, C++
gvenusleo
gvenusleo

Dart
hpstory
hpstory

C#
justin-tse
justin-tse

JS, TS
krahets
krahets

Java, Python
night-cruise
night-cruise

Rust
nuomi1
nuomi1

Swift
Reanon
Reanon

Go, C
sjinzh
sjinzh

Rust, Zig
diff --git a/mkdocs.yml b/mkdocs.yml index a56d09c59..7c8db159a 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -64,7 +64,7 @@ theme: icon: logo: logo repo: fontawesome/brands/github - edit: material/file-edit-outline + edit: fontawesome/regular/pen-to-square extra: alternate: diff --git a/overrides/partials/.gitignore b/overrides/partials/.gitignore new file mode 100644 index 000000000..3eebfb928 --- /dev/null +++ b/overrides/partials/.gitignore @@ -0,0 +1 @@ +comments.html \ No newline at end of file diff --git a/overrides/partials/LICENSE b/overrides/partials/LICENSE new file mode 100644 index 000000000..98d7a71b5 --- /dev/null +++ b/overrides/partials/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2016-2023 Martin Donath + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to +deal in the Software without restriction, including without limitation the +rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +IN THE SOFTWARE. \ No newline at end of file diff --git a/overrides/partials/actions.html b/overrides/partials/actions.html new file mode 100644 index 000000000..86eace6ea --- /dev/null +++ b/overrides/partials/actions.html @@ -0,0 +1,32 @@ + +{% if page.edit_url %} + + + {% if "content.action.edit" in features and "edit" not in page.meta.hide %} + + {% set icon = config.theme.icon.edit or "material/file-edit-outline" %} + {% include ".icons/" ~ icon ~ ".svg" %} + + {% endif %} + + + {% if "content.action.view" in features %} + {% if "/blob/" in page.edit_url %} + {% set part = "blob" %} + {% else %} + {% set part = "edit" %} + {% endif %} + + {% set icon = config.theme.icon.view or "material/file-eye-outline" %} + {% include ".icons/" ~ icon ~ ".svg" %} + + {% endif %} +{% endif %} \ No newline at end of file diff --git a/overrides/partials/content.html b/overrides/partials/content.html index dc2639dc7..38323c9ae 100644 --- a/overrides/partials/content.html +++ b/overrides/partials/content.html @@ -1,25 +1,3 @@ - - {% if "material/tags" in config.plugins and tags %} {% include "partials/tags.html" %} @@ -28,14 +6,6 @@ {% include "partials/actions.html" %} - -{% if "\x3ch1" not in page.content %} -

{{ page.title | d(config.site_name, true)}}

-{% endif %} - {{ page.content }} diff --git a/overrides/stylesheets/extra.css b/overrides/stylesheets/extra.css index e7a289b66..08e4af7b2 100644 --- a/overrides/stylesheets/extra.css +++ b/overrides/stylesheets/extra.css @@ -15,7 +15,10 @@ --md-admonition-fg-color: #1d1d20; --md-typeset-color: #1d1d20; - --md-typeset-a-color: #2aa996; + --md-typeset-a-color: #349890; + + --md-typeset-btn-color: #55aea6; + --md-typeset-btn-hover-color: #52bbb1; } [data-md-color-scheme="slate"] { @@ -35,7 +38,10 @@ --md-footer-fg-color: #adbac7; --md-typeset-color: #adbac7; - --md-typeset-a-color: #21c8b8 !important; + --md-typeset-a-color: #52bbb1 !important; + + --md-typeset-btn-color: #52bbb1; + --md-typeset-btn-hover-color: #55aea6; } /* https://github.com/squidfunk/mkdocs-material/issues/4832#issuecomment-1374891676 */ @@ -119,3 +125,40 @@ body { [data-md-color-scheme="slate"] .md-typeset video { filter: brightness(0.85) invert(0.05); } + +/* landing page */ +.header-img-div { + display: flex; + align-items: center; + justify-content: center; + margin: 0 auto; + width: 100%; /* Default to full width */ +} + +/* rounded button */ +.rounded-button { + display: inline-flex; /* Use flexbox for alignment */ + align-items: center; /* Align items vertically */ + justify-content: center; /* Center items horizontally */ + border-radius: 100px; /* Circular corners */ + padding: 9px 18px; /* Padding around the text */ + margin: 0.15em 0; + border: none; /* Removes default border */ + background-color: var(--md-typeset-btn-color); /* Background color */ + color: var(--md-primary-fg-color) !important; /* Text color */ + font-size: 0.85em; /* Font size */ + text-align: center; /* Center the text */ + text-decoration: none; /* Remove underline from anchor text */ + cursor: pointer; /* Pointer cursor on hover */ +} + +.rounded-button:hover { + background-color: var(--md-typeset-btn-hover-color); +} + +.rounded-button svg { + fill: var(--md-primary-fg-color); /* Fill SVG icon with text color */ + width: 1.2em; + height: auto; + margin-right: 0.5em; /* Add some space between the SVG icon and the text */ +}