mirror of
https://github.com/krahets/hello-algo.git
synced 2024-12-26 01:56:31 +08:00
build
This commit is contained in:
parent
c71f25c4ad
commit
4556e0971c
5 changed files with 521 additions and 143 deletions
|
@ -461,7 +461,7 @@ For example, in the following code, the condition variable $i$ is updated twice
|
|||
int WhileLoopII(int n) {
|
||||
int res = 0;
|
||||
int i = 1; // 初始化条件变量
|
||||
// 循环求和 1, 2, 4, 5...
|
||||
// 循环求和 1, 4, 10, ...
|
||||
while (i <= n) {
|
||||
res += i;
|
||||
// 更新条件变量
|
||||
|
|
|
@ -108,8 +108,7 @@ hide:
|
|||
</div>
|
||||
|
||||
<div class="admonition quote">
|
||||
<p align="center">"Chase the wind and moon, never stopping"</p>
|
||||
<p align="center">"Beyond the plains, there are spring mountains"</p>
|
||||
<p align="center">"Knowledge increases by sharing."</p>
|
||||
</div>
|
||||
|
||||
---
|
||||
|
|
|
@ -461,7 +461,7 @@ comments: true
|
|||
int WhileLoopII(int n) {
|
||||
int res = 0;
|
||||
int i = 1; // 初始化条件变量
|
||||
// 循环求和 1, 2, 4, 5...
|
||||
// 循环求和 1, 4, 10, ...
|
||||
while (i <= n) {
|
||||
res += i;
|
||||
// 更新条件变量
|
||||
|
|
477
docs/index.md
477
docs/index.md
|
@ -5,152 +5,351 @@ hide:
|
|||
- footer
|
||||
- toc
|
||||
- edit
|
||||
- navigation
|
||||
---
|
||||
|
||||
<div class="header-img-div" style="max-width: 600px;">
|
||||
<img src="index.assets/hello_algo_header.png" style="width: 100%; height: auto; margin-left: 15px; margin-right: 15px;">
|
||||
</div>
|
||||
<!--Section: hero -->
|
||||
<section data-md-color-scheme="slate" data-md-color-primary="grey" class="home-div"
|
||||
style="height: min(100vh, 120vw); position: relative; margin-top:-2.4rem; padding: 0; overflow: hidden;">
|
||||
<!-- background -->
|
||||
<img src="assets/hero/universe_bg.png" class="hero-bg">
|
||||
|
||||
<h2 align="center" style="margin-top: 25px;">《 Hello 算法 》</h2>
|
||||
|
||||
<p align="center">动画图解、一键运行的数据结构与算法教程</p>
|
||||
|
||||
<p align="center">
|
||||
<a href="https://github.com/krahets/hello-algo">
|
||||
<img alt="GitHub repo stars" src="https://img.shields.io/github/stars/krahets/hello-algo?style=social&link=https%3A%2F%2Fgithub.com%2Fkrahets%2Fhello-algo">
|
||||
</a>
|
||||
|
||||
<a href="https://github.com/krahets/hello-algo/releases">
|
||||
<img alt="GitHub all releases" src="https://img.shields.io/github/downloads/krahets/hello-algo/total?style=social&logo=gitbook&logoColor=black&label=Downloads">
|
||||
</a>
|
||||
|
||||
<a href="https://github.com/krahets/hello-algo">
|
||||
<img alt="GitHub contributors" src="https://img.shields.io/github/contributors-anon/krahets/hello-algo?style=social&logo=git&logoColor=%23101010">
|
||||
</a>
|
||||
</p>
|
||||
|
||||
<p align="center">
|
||||
<a href="https://www.hello-algo.com/chapter_preface/" class="rounded-button">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" height="16" width="18" viewBox="0 0 576 512"><!--!Font Awesome Free 6.5.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2023 Fonticons, Inc.--><path d="M249.6 471.5c10.8 3.8 22.4-4.1 22.4-15.5V78.6c0-4.2-1.6-8.4-5-11C247.4 52 202.4 32 144 32C93.5 32 46.3 45.3 18.1 56.1C6.8 60.5 0 71.7 0 83.8V454.1c0 11.9 12.8 20.2 24.1 16.5C55.6 460.1 105.5 448 144 448c33.9 0 79 14 105.6 23.5zm76.8 0C353 462 398.1 448 432 448c38.5 0 88.4 12.1 119.9 22.6c11.3 3.8 24.1-4.6 24.1-16.5V83.8c0-12.1-6.8-23.3-18.1-27.6C529.7 45.3 482.5 32 432 32c-58.4 0-103.4 20-123 35.6c-3.3 2.6-5 6.8-5 11V456c0 11.4 11.7 19.3 22.4 15.5z"/></svg>
|
||||
开始阅读
|
||||
</a>
|
||||
<a href="https://github.com/krahets/hello-algo" class="rounded-button">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" height="16px" width="15.5px" viewBox="0 0 496 512"><!--!Font Awesome Free 6.5.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2023 Fonticons, Inc.--><path d="M165.9 397.4c0 2-2.3 3.6-5.2 3.6-3.3 .3-5.6-1.3-5.6-3.6 0-2 2.3-3.6 5.2-3.6 3-.3 5.6 1.3 5.6 3.6zm-31.1-4.5c-.7 2 1.3 4.3 4.3 4.9 2.6 1 5.6 0 6.2-2s-1.3-4.3-4.3-5.2c-2.6-.7-5.5 .3-6.2 2.3zm44.2-1.7c-2.9 .7-4.9 2.6-4.6 4.9 .3 2 2.9 3.3 5.9 2.6 2.9-.7 4.9-2.6 4.6-4.6-.3-1.9-3-3.2-5.9-2.9zM244.8 8C106.1 8 0 113.3 0 252c0 110.9 69.8 205.8 169.5 239.2 12.8 2.3 17.3-5.6 17.3-12.1 0-6.2-.3-40.4-.3-61.4 0 0-70 15-84.7-29.8 0 0-11.4-29.1-27.8-36.6 0 0-22.9-15.7 1.6-15.4 0 0 24.9 2 38.6 25.8 21.9 38.6 58.6 27.5 72.9 20.9 2.3-16 8.8-27.1 16-33.7-55.9-6.2-112.3-14.3-112.3-110.5 0-27.5 7.6-41.3 23.6-58.9-2.6-6.5-11.1-33.3 2.6-67.9 20.9-6.5 69 27 69 27 20-5.6 41.5-8.5 62.8-8.5s42.8 2.9 62.8 8.5c0 0 48.1-33.6 69-27 13.7 34.7 5.2 61.4 2.6 67.9 16 17.7 25.8 31.5 25.8 58.9 0 96.5-58.9 104.2-114.8 110.5 9.2 7.9 17 22.9 17 46.4 0 33.7-.3 75.4-.3 83.6 0 6.5 4.6 14.4 17.3 12.1C428.2 457.8 496 362.9 496 252 496 113.3 383.5 8 244.8 8zM97.2 352.9c-1.3 1-1 3.3 .7 5.2 1.6 1.6 3.9 2.3 5.2 1 1.3-1 1-3.3-.7-5.2-1.6-1.6-3.9-2.3-5.2-1zm-10.8-8.1c-.7 1.3 .3 2.9 2.3 3.9 1.6 1 3.6 .7 4.3-.7 .7-1.3-.3-2.9-2.3-3.9-2-.6-3.6-.3-4.3 .7zm32.4 35.6c-1.6 1.3-1 4.3 1.3 6.2 2.3 2.3 5.2 2.6 6.5 1 1.3-1.3 .7-4.3-1.3-6.2-2.2-2.3-5.2-2.6-6.5-1zm-11.4-14.7c-1.6 1-1.6 3.6 0 5.9 1.6 2.3 4.3 3.3 5.6 2.3 1.6-1.3 1.6-3.9 0-6.2-1.4-2.3-4-3.3-5.6-2z"/></svg>
|
||||
下载代码
|
||||
</a>
|
||||
<a href="https://github.com/krahets/hello-algo/releases" class="rounded-button">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" height="16" width="16" viewBox="0 0 512 512"><!--!Font Awesome Free 6.5.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2023 Fonticons, Inc.--><path d="M0 64C0 28.7 28.7 0 64 0L224 0l0 128c0 17.7 14.3 32 32 32l128 0 0 144-208 0c-35.3 0-64 28.7-64 64l0 144-48 0c-35.3 0-64-28.7-64-64L0 64zm384 64l-128 0L256 0 384 128zM176 352l32 0c30.9 0 56 25.1 56 56s-25.1 56-56 56l-16 0 0 32c0 8.8-7.2 16-16 16s-16-7.2-16-16l0-48 0-80c0-8.8 7.2-16 16-16zm32 80c13.3 0 24-10.7 24-24s-10.7-24-24-24l-16 0 0 48 16 0zm96-80l32 0c26.5 0 48 21.5 48 48l0 64c0 26.5-21.5 48-48 48l-32 0c-8.8 0-16-7.2-16-16l0-128c0-8.8 7.2-16 16-16zm32 128c8.8 0 16-7.2 16-16l0-64c0-8.8-7.2-16-16-16l-16 0 0 96 16 0zm80-112c0-8.8 7.2-16 16-16l48 0c8.8 0 16 7.2 16 16s-7.2 16-16 16l-32 0 0 32 32 0c8.8 0 16 7.2 16 16s-7.2 16-16 16l-32 0 0 48c0 8.8-7.2 16-16 16s-16-7.2-16-16l0-64 0-64z"/></svg>
|
||||
下载 PDF
|
||||
</a>
|
||||
</p>
|
||||
|
||||
<img src="index.assets/hello_algo_hero.jpg" class="cover-image" style="width: 100%; margin-top: 27px;">
|
||||
|
||||
<div style="display: flex;">
|
||||
<div class="admonition quote" style="flex: 1; margin-right: 0.4rem;">
|
||||
<p class="admonition-title">Quote</p>
|
||||
<p>“一本通俗易懂的数据结构与算法入门书,引导读者手脑并用地学习,强烈推荐算法初学者阅读。”</p>
|
||||
<p><strong>—— 邓俊辉,清华大学计算机系教授</strong></p>
|
||||
</div>
|
||||
<div class="admonition quote" style="flex: 1; margin-left: 0.4rem;">
|
||||
<p class="admonition-title">Quote</p>
|
||||
<p>“如果我当年学数据结构与算法的时候有《Hello 算法》,学起来应该会简单 10 倍!”</p>
|
||||
<p><strong>—— 李沐,亚马逊资深首席科学家</strong></p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
---
|
||||
|
||||
<div style="display: flex; align-items: center; margin: 2rem auto;">
|
||||
<div style="flex: 1; margin: 0 2rem; display: flex; flex-direction: column; align-items: center;">
|
||||
<div style="display: flex; flex-direction: column; align-items: center;">
|
||||
<h3>动画图解</h3>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" height="28" width="28" viewBox="0 0 640 512"><!--!Font Awesome Free 6.5.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2023 Fonticons, Inc.--><path fill="var(--md-primary-bg-color)" d="M256 0H576c35.3 0 64 28.7 64 64V288c0 35.3-28.7 64-64 64H256c-35.3 0-64-28.7-64-64V64c0-35.3 28.7-64 64-64zM476 106.7C471.5 100 464 96 456 96s-15.5 4-20 10.7l-56 84L362.7 169c-4.6-5.7-11.5-9-18.7-9s-14.2 3.3-18.7 9l-64 80c-5.8 7.2-6.9 17.1-2.9 25.4s12.4 13.6 21.6 13.6h80 48H552c8.9 0 17-4.9 21.2-12.7s3.7-17.3-1.2-24.6l-96-144zM336 96a32 32 0 1 0 -64 0 32 32 0 1 0 64 0zM64 128h96V384v32c0 17.7 14.3 32 32 32H320c17.7 0 32-14.3 32-32V384H512v64c0 35.3-28.7 64-64 64H64c-35.3 0-64-28.7-64-64V192c0-35.3 28.7-64 64-64zm8 64c-8.8 0-16 7.2-16 16v16c0 8.8 7.2 16 16 16H88c8.8 0 16-7.2 16-16V208c0-8.8-7.2-16-16-16H72zm0 104c-8.8 0-16 7.2-16 16v16c0 8.8 7.2 16 16 16H88c8.8 0 16-7.2 16-16V312c0-8.8-7.2-16-16-16H72zm0 104c-8.8 0-16 7.2-16 16v16c0 8.8 7.2 16 16 16H88c8.8 0 16-7.2 16-16V416c0-8.8-7.2-16-16-16H72zm336 16v16c0 8.8 7.2 16 16 16h16c8.8 0 16-7.2 16-16V416c0-8.8-7.2-16-16-16H424c-8.8 0-16 7.2-16 16z"/></svg>
|
||||
<!-- heading and buttons -->
|
||||
<div style="width: 100%; position: absolute; transform: translateX(-50%); left: 49%; bottom: min(2vh, 3vw);">
|
||||
<img style="height: min(6vh, 8vw);"
|
||||
src="https://readme-typing-svg.demolab.com/?font=Noto+Sans+SC&weight=400&size=35&duration=3500&pause=2000&color=FFF¢er=true&vCenter=true&random=false&width=200&lines=Hello%2C+%E7%AE%97%E6%B3%95+!"
|
||||
alt="hello-algo-typing-svg" />
|
||||
<p style="color: #fff; margin-top: min(0.5vh, 1vw); margin-bottom: min(2vh, 3vw);">
|
||||
动画图解、一键运行的数据结构与算法教程
|
||||
</p>
|
||||
<div>
|
||||
<a href="https://www.hello-algo.com/chapter_preface/" class="rounded-button hero-btn">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" height="16px" width="15.5px"
|
||||
viewBox="0 0 576 512"><!--!Font Awesome Free 6.5.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2023 Fonticons, Inc.-->
|
||||
<path
|
||||
d="M249.6 471.5c10.8 3.8 22.4-4.1 22.4-15.5V78.6c0-4.2-1.6-8.4-5-11C247.4 52 202.4 32 144 32C93.5 32 46.3 45.3 18.1 56.1C6.8 60.5 0 71.7 0 83.8V454.1c0 11.9 12.8 20.2 24.1 16.5C55.6 460.1 105.5 448 144 448c33.9 0 79 14 105.6 23.5zm76.8 0C353 462 398.1 448 432 448c38.5 0 88.4 12.1 119.9 22.6c11.3 3.8 24.1-4.6 24.1-16.5V83.8c0-12.1-6.8-23.3-18.1-27.6C529.7 45.3 482.5 32 432 32c-58.4 0-103.4 20-123 35.6c-3.3 2.6-5 6.8-5 11V456c0 11.4 11.7 19.3 22.4 15.5z">
|
||||
</path>
|
||||
</svg>
|
||||
开始阅读
|
||||
</a>
|
||||
<a href="https://github.com/krahets/hello-algo" class="rounded-button hero-btn">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" height="16px" width="15.5px"
|
||||
viewBox="0 0 496 512"><!--!Font Awesome Free 6.5.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2023 Fonticons, Inc.-->
|
||||
<path
|
||||
d="M165.9 397.4c0 2-2.3 3.6-5.2 3.6-3.3 .3-5.6-1.3-5.6-3.6 0-2 2.3-3.6 5.2-3.6 3-.3 5.6 1.3 5.6 3.6zm-31.1-4.5c-.7 2 1.3 4.3 4.3 4.9 2.6 1 5.6 0 6.2-2s-1.3-4.3-4.3-5.2c-2.6-.7-5.5 .3-6.2 2.3zm44.2-1.7c-2.9 .7-4.9 2.6-4.6 4.9 .3 2 2.9 3.3 5.9 2.6 2.9-.7 4.9-2.6 4.6-4.6-.3-1.9-3-3.2-5.9-2.9zM244.8 8C106.1 8 0 113.3 0 252c0 110.9 69.8 205.8 169.5 239.2 12.8 2.3 17.3-5.6 17.3-12.1 0-6.2-.3-40.4-.3-61.4 0 0-70 15-84.7-29.8 0 0-11.4-29.1-27.8-36.6 0 0-22.9-15.7 1.6-15.4 0 0 24.9 2 38.6 25.8 21.9 38.6 58.6 27.5 72.9 20.9 2.3-16 8.8-27.1 16-33.7-55.9-6.2-112.3-14.3-112.3-110.5 0-27.5 7.6-41.3 23.6-58.9-2.6-6.5-11.1-33.3 2.6-67.9 20.9-6.5 69 27 69 27 20-5.6 41.5-8.5 62.8-8.5s42.8 2.9 62.8 8.5c0 0 48.1-33.6 69-27 13.7 34.7 5.2 61.4 2.6 67.9 16 17.7 25.8 31.5 25.8 58.9 0 96.5-58.9 104.2-114.8 110.5 9.2 7.9 17 22.9 17 46.4 0 33.7-.3 75.4-.3 83.6 0 6.5 4.6 14.4 17.3 12.1C428.2 457.8 496 362.9 496 252 496 113.3 383.5 8 244.8 8zM97.2 352.9c-1.3 1-1 3.3 .7 5.2 1.6 1.6 3.9 2.3 5.2 1 1.3-1 1-3.3-.7-5.2-1.6-1.6-3.9-2.3-5.2-1zm-10.8-8.1c-.7 1.3 .3 2.9 2.3 3.9 1.6 1 3.6 .7 4.3-.7 .7-1.3-.3-2.9-2.3-3.9-2-.6-3.6-.3-4.3 .7zm32.4 35.6c-1.6 1.3-1 4.3 1.3 6.2 2.3 2.3 5.2 2.6 6.5 1 1.3-1.3 .7-4.3-1.3-6.2-2.2-2.3-5.2-2.6-6.5-1zm-11.4-14.7c-1.6 1-1.6 3.6 0 5.9 1.6 2.3 4.3 3.3 5.6 2.3 1.6-1.3 1.6-3.9 0-6.2-1.4-2.3-4-3.3-5.6-2z">
|
||||
</path>
|
||||
</svg>
|
||||
代码仓库
|
||||
</a>
|
||||
<a href="https://github.com/krahets/hello-algo/releases" class="rounded-button hero-btn">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" height="16px" width="15.5px"
|
||||
viewBox="0 0 512 512"><!--!Font Awesome Free 6.5.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2023 Fonticons, Inc.-->
|
||||
<path
|
||||
d="M0 64C0 28.7 28.7 0 64 0L224 0l0 128c0 17.7 14.3 32 32 32l128 0 0 144-208 0c-35.3 0-64 28.7-64 64l0 144-48 0c-35.3 0-64-28.7-64-64L0 64zm384 64l-128 0L256 0 384 128zM176 352l32 0c30.9 0 56 25.1 56 56s-25.1 56-56 56l-16 0 0 32c0 8.8-7.2 16-16 16s-16-7.2-16-16l0-48 0-80c0-8.8 7.2-16 16-16zm32 80c13.3 0 24-10.7 24-24s-10.7-24-24-24l-16 0 0 48 16 0zm96-80l32 0c26.5 0 48 21.5 48 48l0 64c0 26.5-21.5 48-48 48l-32 0c-8.8 0-16-7.2-16-16l0-128c0-8.8 7.2-16 16-16zm32 128c8.8 0 16-7.2 16-16l0-64c0-8.8-7.2-16-16-16l-16 0 0 96 16 0zm80-112c0-8.8 7.2-16 16-16l48 0c8.8 0 16 7.2 16 16s-7.2 16-16 16l-32 0 0 32 32 0c8.8 0 16 7.2 16 16s-7.2 16-16 16l-32 0 0 48c0 8.8-7.2 16-16 16s-16-7.2-16-16l0-64 0-64z">
|
||||
</path>
|
||||
</svg>
|
||||
下载 PDF
|
||||
</a>
|
||||
</div>
|
||||
<p style="text-align: center;">内容清晰易懂</br>学习曲线平滑</p>
|
||||
</div>
|
||||
<img src="index.assets/animation.gif" class="cover-image" style="flex-shrink: 0; width: auto; max-width: 50%; border-radius: 0.5rem;">
|
||||
</div>
|
||||
|
||||
<div class="admonition quote">
|
||||
<p align="center">"A picture is worth a thousand words."</p>
|
||||
<p align="center">“一图胜千言”</p>
|
||||
</div>
|
||||
|
||||
<div style="display: flex; align-items: center; margin: 2rem auto;">
|
||||
<img src="index.assets/running_code.gif" class="cover-image" style="flex-shrink: 0; width: auto; max-width: 50%; border-radius: 0.5rem;">
|
||||
<div style="flex: 1; margin: 0 2rem; display: flex; flex-direction: column; align-items: center;">
|
||||
<div style="display: flex; flex-direction: column; align-items: center;">
|
||||
<h3>一键运行</h3>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" height="28" width="28" viewBox="0 0 640 512"><!--!Font Awesome Free 6.5.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2023 Fonticons, Inc.--><path fill="var(--md-primary-bg-color)" d="M392.8 1.2c-17-4.9-34.7 5-39.6 22l-128 448c-4.9 17 5 34.7 22 39.6s34.7-5 39.6-22l128-448c4.9-17-5-34.7-22-39.6zm80.6 120.1c-12.5 12.5-12.5 32.8 0 45.3L562.7 256l-89.4 89.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0l112-112c12.5-12.5 12.5-32.8 0-45.3l-112-112c-12.5-12.5-32.8-12.5-45.3 0zm-306.7 0c-12.5-12.5-32.8-12.5-45.3 0l-112 112c-12.5 12.5-12.5 32.8 0 45.3l112 112c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L77.3 256l89.4-89.4c12.5-12.5 12.5-32.8 0-45.3z"/></svg>
|
||||
<!-- arrow -->
|
||||
<div style="text-align: center; margin-top: min(2.5vh, 3.5vw);">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" fill="var(--md-default-fg-color)" height="2vh" width="auto"
|
||||
viewBox="0 0 384 512"><!--!Font Awesome Free 6.5.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2024 Fonticons, Inc.-->
|
||||
<path
|
||||
d="M169.4 470.6c12.5 12.5 32.8 12.5 45.3 0l160-160c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L224 370.8 224 64c0-17.7-14.3-32-32-32s-32 14.3-32 32l0 306.7L54.6 265.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3l160 160z" />
|
||||
</svg>
|
||||
</div>
|
||||
<p style="text-align: center;">十余种编程语言</br>代码可直接运行</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="admonition quote">
|
||||
<p align="center">"Talk is cheap. Show me the code."</p>
|
||||
<p align="center">“少吹牛,看代码”</p>
|
||||
</div>
|
||||
|
||||
<div style="display: flex; align-items: center; margin: 2rem auto;">
|
||||
<div style="flex: 1; margin: 0 2rem; display: flex; flex-direction: column; align-items: center;">
|
||||
<div style="display: flex; flex-direction: column; align-items: center;">
|
||||
<h3>互助学习</h3>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" height="28" width="28" viewBox="0 0 640 512"><!--!Font Awesome Free 6.5.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2023 Fonticons, Inc.--><path fill="var(--md-primary-bg-color)" d="M88.2 309.1c9.8-18.3 6.8-40.8-7.5-55.8C59.4 230.9 48 204 48 176c0-63.5 63.8-128 160-128s160 64.5 160 128s-63.8 128-160 128c-13.1 0-25.8-1.3-37.8-3.6c-10.4-2-21.2-.6-30.7 4.2c-4.1 2.1-8.3 4.1-12.6 6c-16 7.2-32.9 13.5-49.9 18c2.8-4.6 5.4-9.1 7.9-13.6c1.1-1.9 2.2-3.9 3.2-5.9zM0 176c0 41.8 17.2 80.1 45.9 110.3c-.9 1.7-1.9 3.5-2.8 5.1c-10.3 18.4-22.3 36.5-36.6 52.1c-6.6 7-8.3 17.2-4.6 25.9C5.8 378.3 14.4 384 24 384c43 0 86.5-13.3 122.7-29.7c4.8-2.2 9.6-4.5 14.2-6.8c15.1 3 30.9 4.5 47.1 4.5c114.9 0 208-78.8 208-176S322.9 0 208 0S0 78.8 0 176zM432 480c16.2 0 31.9-1.6 47.1-4.5c4.6 2.3 9.4 4.6 14.2 6.8C529.5 498.7 573 512 616 512c9.6 0 18.2-5.7 22-14.5c3.8-8.8 2-19-4.6-25.9c-14.2-15.6-26.2-33.7-36.6-52.1c-.9-1.7-1.9-3.4-2.8-5.1C622.8 384.1 640 345.8 640 304c0-94.4-87.9-171.5-198.2-175.8c4.1 15.2 6.2 31.2 6.2 47.8l0 .6c87.2 6.7 144 67.5 144 127.4c0 28-11.4 54.9-32.7 77.2c-14.3 15-17.3 37.6-7.5 55.8c1.1 2 2.2 4 3.2 5.9c2.5 4.5 5.2 9 7.9 13.6c-17-4.5-33.9-10.7-49.9-18c-4.3-1.9-8.5-3.9-12.6-6c-9.5-4.8-20.3-6.2-30.7-4.2c-12.1 2.4-24.7 3.6-37.8 3.6c-61.7 0-110-26.5-136.8-62.3c-16 5.4-32.8 9.4-50 11.8C279 439.8 350 480 432 480z"/></svg>
|
||||
</div>
|
||||
<p style="text-align: center;">欢迎讨论与提问</br>读者间携手共进</p>
|
||||
</div>
|
||||
<img src="index.assets/comment.gif" class="cover-image" style="flex-shrink: 0; width: auto; max-width: 50%; border-radius: 0.5rem;">
|
||||
</div>
|
||||
|
||||
<div class="admonition quote">
|
||||
<p align="center">"Knowledge increases by sharing."</p>
|
||||
<p align="center">“知识在分享中得以增长”</p>
|
||||
</div>
|
||||
|
||||
---
|
||||
|
||||
<h3 align="center"> 序 </h3>
|
||||
|
||||
两年前,我在力扣上分享了“剑指 Offer”系列题解,受到了许多同学的喜爱和支持。在与读者交流期间,我最常收到的一个问题是“如何入门算法”。逐渐地,我对这个问题产生了浓厚的兴趣。
|
||||
|
||||
两眼一抹黑地刷题似乎是最受欢迎的方法,简单直接且有效。然而刷题就如同玩“扫雷”游戏,自学能力强的同学能够顺利将地雷逐个排掉,而基础不足的同学很可能被炸得满头是包,并在挫折中步步退缩。通读教材也是一种常见做法,但对于面向求职的同学来说,毕业季、投递简历、准备笔试面试已经消耗了大部分精力,啃厚重的书往往变成了一项艰巨的挑战。
|
||||
|
||||
如果你也面临类似的困扰,那么很幸运这本书找到了你。本书是我对这个问题给出的答案,即使不是最优解,也至少是一次积极的尝试。本书虽然不足以让你直接拿到 Offer ,但会引导你探索数据结构与算法的“知识地图”,带你了解不同“地雷”的形状、大小和分布位置,让你掌握各种“排雷方法”。有了这些本领,相信你可以更加自如地刷题和阅读文献,逐步构建起完整的知识体系。
|
||||
|
||||
我深深赞同费曼教授所言:“Knowledge isn't free. You have to pay attention.”从这个意义上看,这本书并非完全“免费”。为了不辜负你为本书所付出的宝贵“注意力”,我会尽我所能,投入最大的“注意力”来完成这本书的创作。
|
||||
|
||||
<h3 align="left"> 作者 </h3>
|
||||
|
||||
靳宇栋 ([Krahets](https://leetcode.cn/u/jyd/)),大厂高级算法工程师,上海交通大学硕士。力扣(LeetCode)全网阅读量最高博主,发表的[《图解算法数据结构》](https://leetcode.cn/leetbook/detail/illustration-of-algorithm/)已被订阅 30 万本。
|
||||
|
||||
---
|
||||
|
||||
<h3 align="center"> 贡献 </h3>
|
||||
|
||||
本书在开源社区众多贡献者的共同努力下不断完善。感谢每一位投入时间与精力的撰稿人,他们是(按照 GitHub 自动生成的顺序排列):
|
||||
|
||||
<p align="center">
|
||||
<a href="https://github.com/krahets/hello-algo/graphs/contributors">
|
||||
<img width="550" src="https://contrib.rocks/image?repo=krahets/hello-algo">
|
||||
<!-- hero image -->
|
||||
<div class="hero-image-div">
|
||||
<!-- planets -->
|
||||
<img src="assets/hero/ground.png"
|
||||
style="position: absolute; width: auto; height: 26.445%; left: 27.211%; top: 54.145%;">
|
||||
<img src="assets/hero/links.png"
|
||||
style="position: absolute; width: auto; height: 78.751%; left: 9.545%; top: 7.326%;">
|
||||
<a href="https://www.hello-algo.com/chapter_introduction/">
|
||||
<img class="hero-on-hover" src="assets/hero/astronaut.png" style="height: 46.673%; left: 34.413%; top: 24.343%;">
|
||||
<p class="hero-caption" style="left: 51.244%; top: 20.919%;">初识算法</p>
|
||||
</a>
|
||||
</p>
|
||||
<a href="https://www.hello-algo.com/chapter_computational_complexity/">
|
||||
<img class="hero-on-hover" src="assets/hero/chapter_computational_complexity.png"
|
||||
style="height: 12.347%; left: 35.267%; top: 37.653%;">
|
||||
<p class="hero-caption" style="left: 38.244%; top: 33.919%;">复杂度</p>
|
||||
</a>
|
||||
<a href="https://www.hello-algo.com/chapter_array_and_linkedlist/">
|
||||
<img class="hero-on-hover" src="assets/hero/chapter_array_and_linkedlist.png"
|
||||
style="height: 22.242%; left: 72.242%; top: 52.481%;">
|
||||
<p class="hero-caption" style="left: 87.297%; top: 77.059%;">数组与链表</p>
|
||||
</a>
|
||||
<a href="https://www.hello-algo.com/chapter_stack_and_queue/">
|
||||
<img class="hero-on-hover" src="assets/hero/chapter_stack_and_queue.png"
|
||||
style="height: 14.302%; left: 61.646%; top: 77.875%;">
|
||||
<p class="hero-caption" style="left: 77.071%; top: 89.25%;">栈与队列</p>
|
||||
</a>
|
||||
<a href="https://www.hello-algo.com/chapter_hashing/">
|
||||
<img class="hero-on-hover" src="assets/hero/chapter_hashing.png"
|
||||
style="height: 15.266%; left: 62.281%; top: 27.933%;">
|
||||
<p class="hero-caption" style="left: 67.862%; top: 46.292%;">哈希表</p>
|
||||
</a>
|
||||
<a href="https://www.hello-algo.com/chapter_tree/">
|
||||
<img class="hero-on-hover" src="assets/hero/chapter_tree.png"
|
||||
style="height: 19.615%; left: 79.137%; top: 26.678%;">
|
||||
<p class="hero-caption" style="left: 95.159%; top: 44.8%;">树</p>
|
||||
</a>
|
||||
<a href="https://www.hello-algo.com/chapter_heap/">
|
||||
<img class="hero-on-hover" src="assets/hero/chapter_heap.png"
|
||||
style="height: 10.566%; left: 76.226%; top: 11.559%;">
|
||||
<p class="hero-caption" style="left: 87.103%; top: 15.422%;">堆</p>
|
||||
</a>
|
||||
<a href="https://www.hello-algo.com/chapter_graph/">
|
||||
<img class="hero-on-hover" src="assets/hero/chapter_graph.png"
|
||||
style="height: 16.112%; left: 50.854%; top: 5.575%;">
|
||||
<p class="hero-caption" style="left: 70.195%; top: 6.503%;">图</p>
|
||||
</a>
|
||||
<a href="https://www.hello-algo.com/chapter_searching/">
|
||||
<img class="hero-on-hover" src="assets/hero/chapter_searching.png"
|
||||
style="height: 15.149%; left: 17.185%; top: 16.404%;">
|
||||
<p class="hero-caption" style="left: 13.556%; top: 20.876%;">搜索</p>
|
||||
</a>
|
||||
<a href="https://www.hello-algo.com/chapter_sorting/">
|
||||
<img class="hero-on-hover" src="assets/hero/chapter_sorting.png"
|
||||
style="height: 9.574%; left: 24.409%; top: 40.747%;">
|
||||
<p class="hero-caption" style="left: 27.805%; top: 53.808%;">排序</p>
|
||||
</a>
|
||||
<a href="https://www.hello-algo.com/chapter_divide_and_conquer/">
|
||||
<img class="hero-on-hover" src="assets/hero/chapter_divide_and_conquer.png"
|
||||
style="height: 18.681%; left: 31.721%; top: 4.816%;">
|
||||
<p class="hero-caption" style="left: 30.42%; top: 8.679%;">分治</p>
|
||||
</a>
|
||||
<a href="https://www.hello-algo.com/chapter_backtracking/">
|
||||
<img class="hero-on-hover" src="assets/hero/chapter_backtracking.png"
|
||||
style="height: 17.338%; left: 3.875%; top: 32.925%;">
|
||||
<p class="hero-caption" style="left: 3.742%; top: 50.113%;">回溯</p>
|
||||
</a>
|
||||
<a href="https://www.hello-algo.com/chapter_dynamic_programming/">
|
||||
<img class="hero-on-hover" src="assets/hero/chapter_dynamic_programming.png"
|
||||
style="height: 15.47%; left: 8.406%; top: 57.472%;">
|
||||
<p class="hero-caption" style="left: 7.561%; top: 75.351%;">动态规划</p>
|
||||
</a>
|
||||
<a href="https://www.hello-algo.com/chapter_greedy/">
|
||||
<img class="hero-on-hover" src="assets/hero/chapter_greedy.png"
|
||||
style="height: 14.127%; left: 22.132%; top: 75.803%;">
|
||||
<p class="hero-caption" style="left: 20.619%; top: 86.85%;">贪心</p>
|
||||
</a>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
本书的代码审阅工作由 codingonion、Gonglja、gvenusleo、hpstory、justin-tse、krahets、night-cruise、nuomi1 和 Reanon 完成(按照首字母顺序排列)。感谢他们付出的时间与精力,正是他们确保了各语言代码的规范与统一。
|
||||
<!-- Section: brief introduction -->
|
||||
<section data-md-color-scheme="slate" class="home-div">
|
||||
<div class="section-content">
|
||||
<div style="margin-top: 1em;">
|
||||
<img src="index.assets/hello_algo_header.png" style="width: 100%; max-width: 750px;">
|
||||
</div>
|
||||
<div style="margin: 0.5em auto;">
|
||||
<img src="https://img.shields.io/badge/Python-snow?logo=python&logoColor=3776AB">
|
||||
<img src="https://img.shields.io/badge/C%2B%2B-snow?logo=c%2B%2B&logoColor=00599C">
|
||||
<img src="https://img.shields.io/badge/Java-snow?logo=coffeescript&logoColor=FC4C02">
|
||||
<img src="https://img.shields.io/badge/C%23-snow?logo=csharp&logoColor=512BD4">
|
||||
<img src="https://img.shields.io/badge/Go-snow?logo=go&logoColor=00ADD8">
|
||||
<img src="https://img.shields.io/badge/Swift-snow?logo=swift&logoColor=F05138">
|
||||
<img src="https://img.shields.io/badge/JavaScript-snow?logo=javascript&logoColor=E9CE30">
|
||||
<img src="https://img.shields.io/badge/TypeScript-snow?logo=typescript&logoColor=3178C6">
|
||||
<img src="https://img.shields.io/badge/Dart-snow?logo=dart&logoColor=0175C2">
|
||||
<img src="https://img.shields.io/badge/Rust-snow?logo=rust&logoColor=000000">
|
||||
<img src="https://img.shields.io/badge/C-snow?logo=c&logoColor=A8B9CC">
|
||||
<img src="https://img.shields.io/badge/Zig-snow?logo=zig&logoColor=F7A41D">
|
||||
</div>
|
||||
<p style="margin-top: 2em;">500 幅动画图解、12 种编程语言代码、2000 条社区问答,助你快速入门数据结构与算法</p>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<div class="center-table">
|
||||
<table style="border: none;">
|
||||
<tbody>
|
||||
<td align="center" style="border: none;"><a href="https://github.com/codingonion"><img style="border-radius: 50%;" src="https://avatars.githubusercontent.com/u/99076655?v=4" width="50px;" alt="codingonion"/></br><sub><b>codingonion</b></sub></a></br><sub>Rust, Zig</sub></td>
|
||||
<td align="center" style="border: none;"><a href="https://github.com/Gonglja"><img style="border-radius: 50%;" src="https://avatars.githubusercontent.com/u/39959756?v=4" width="50px;" alt="Gonglja"/></br><sub><b>Gonglja</b></sub></a></br><sub>C, C++</sub></td>
|
||||
<td align="center" style="border: none;"><a href="https://github.com/gvenusleo"><img style="border-radius: 50%;" src="https://avatars.githubusercontent.com/u/79075347?v=4" width="50px;" alt="gvenusleo"/></br><sub><b>gvenusleo</b></sub></a></br><sub>Dart</sub></td>
|
||||
<td align="center" style="border: none;"><a href="https://github.com/hpstory"><img style="border-radius: 50%;" src="https://avatars.githubusercontent.com/u/33348162?v=4" width="50px;" alt="hpstory"/></br><sub><b>hpstory</b></sub></a></br><sub>C#</sub></td>
|
||||
<td align="center" style="border: none;"><a href="https://github.com/justin-tse"><img style="border-radius: 50%;" src="https://avatars.githubusercontent.com/u/24556310?v=4" width="50px;" alt="justin-tse"/></br><sub><b>justin-tse</b></sub></a></br><sub>JS, TS</sub></td>
|
||||
<td align="center" style="border: none;"><a href="https://github.com/krahets"><img style="border-radius: 50%;" src="https://avatars.githubusercontent.com/u/26993056?v=4" width="50px;" alt="krahets"/></br><sub><b>krahets</b></sub></a></br><sub>Java, Python</sub></td>
|
||||
<td align="center" style="border: none;"><a href="https://github.com/night-cruise"><img style="border-radius: 50%;" src="https://avatars.githubusercontent.com/u/77157236?v=4" width="50px;" alt="night-cruise"/></br><sub><b>night-cruise</b></sub></a></br><sub>Rust</sub></td>
|
||||
<td align="center" style="border: none;"><a href="https://github.com/nuomi1"><img style="border-radius: 50%;" src="https://avatars.githubusercontent.com/u/3739017?v=4" width="50px;" alt="nuomi1"/></br><sub><b>nuomi1</b></sub></a></br><sub>Swift</sub></td>
|
||||
<td align="center" style="border: none;"><a href="https://github.com/Reanon"><img style="border-radius: 50%;" src="https://avatars.githubusercontent.com/u/22005836?v=4" width="50px;" alt="Reanon"/></br><sub><b>Reanon</b></sub></a></br><sub>Go, C</sub></td>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<!-- Section: reading -->
|
||||
<section data-md-color-scheme="default" data-md-color-primary="white" class="home-div">
|
||||
<div class="section-content">
|
||||
<div style="height: min(37vh, 33vw); width: min(75vh, 75vw); position: relative; margin: 1em auto;">
|
||||
<!-- devices -->
|
||||
<!-- mac height = 248.1 mm -->
|
||||
<!-- ipad height = 280.6mm -->
|
||||
<!-- iphone height = 160.7mm -->
|
||||
<img class="device-on-hover" src="assets/hero/web_mac.png" style="height: 88.42%; left: 5%; bottom: 5%;">
|
||||
<img class="device-on-hover" src="assets/hero/pdf_ipad.png" style="height: 100%; left: 60%; bottom: 0%;">
|
||||
<img class="device-on-hover" src="assets/hero/web_iphone.png" style="height: 57.27%; left: 2%; bottom: 0%;">
|
||||
</div>
|
||||
<p style="margin-top: 2em;">提供网页版和 PDF 版,兼容 PC、平板或手机,随时随地阅读</p>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- Section: endorsements -->
|
||||
<section data-md-color-scheme="slate" data-md-color-primary="grey" class="home-div">
|
||||
<div class="section-content">
|
||||
<h3 style="text-align: center; margin: 1em auto;">推荐语</h3>
|
||||
<div class="intro-container" style="margin-bottom: 1em;">
|
||||
<div class="intro-text">
|
||||
<p style="margin-bottom: 0;">“一本通俗易懂的数据结构与算法入门书,引导读者手脑并用地学习,强烈推荐算法初学者阅读。”</p>
|
||||
<p style="font-weight: bold;">—— 邓俊辉,清华大学计算机系教授</p>
|
||||
</div>
|
||||
<div class="intro-text">
|
||||
<p style="margin-bottom: 0;">“如果我当年学数据结构与算法的时候有《Hello 算法》,学起来应该会简单 10 倍!”</p>
|
||||
<p style="font-weight: bold;">—— 李沐,亚马逊资深首席科学家</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- Section: features -->
|
||||
<section data-md-color-scheme="default" data-md-color-primary="white" class="home-div">
|
||||
<div class="section-content">
|
||||
<div class="intro-container">
|
||||
<div class="intro-text">
|
||||
<div>
|
||||
<div style="display: flex; align-items: center;">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" height="1.5em" width="1.5em"
|
||||
viewBox="0 0 640 512"><!--!Font Awesome Free 6.5.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2023 Fonticons, Inc.-->
|
||||
<path fill="var(--md-primary-bg-color)"
|
||||
d="M256 0H576c35.3 0 64 28.7 64 64V288c0 35.3-28.7 64-64 64H256c-35.3 0-64-28.7-64-64V64c0-35.3 28.7-64 64-64zM476 106.7C471.5 100 464 96 456 96s-15.5 4-20 10.7l-56 84L362.7 169c-4.6-5.7-11.5-9-18.7-9s-14.2 3.3-18.7 9l-64 80c-5.8 7.2-6.9 17.1-2.9 25.4s12.4 13.6 21.6 13.6h80 48H552c8.9 0 17-4.9 21.2-12.7s3.7-17.3-1.2-24.6l-96-144zM336 96a32 32 0 1 0 -64 0 32 32 0 1 0 64 0zM64 128h96V384v32c0 17.7 14.3 32 32 32H320c17.7 0 32-14.3 32-32V384H512v64c0 35.3-28.7 64-64 64H64c-35.3 0-64-28.7-64-64V192c0-35.3 28.7-64 64-64zm8 64c-8.8 0-16 7.2-16 16v16c0 8.8 7.2 16 16 16H88c8.8 0 16-7.2 16-16V208c0-8.8-7.2-16-16-16H72zm0 104c-8.8 0-16 7.2-16 16v16c0 8.8 7.2 16 16 16H88c8.8 0 16-7.2 16-16V312c0-8.8-7.2-16-16-16H72zm0 104c-8.8 0-16 7.2-16 16v16c0 8.8 7.2 16 16 16H88c8.8 0 16-7.2 16-16V416c0-8.8-7.2-16-16-16H72zm336 16v16c0 8.8 7.2 16 16 16h16c8.8 0 16-7.2 16-16V416c0-8.8-7.2-16-16-16H424c-8.8 0-16 7.2-16 16z" />
|
||||
</svg>
|
||||
<h3 style="margin-left: 0.5em;">动画图解</h3>
|
||||
</div>
|
||||
<p style="margin: 0;">内容清晰易懂,学习曲线平滑</p>
|
||||
<p class="intro-quote">"A picture is worth a thousand words."</br>“一图胜千言”</p>
|
||||
</div>
|
||||
</div>
|
||||
<img class="intro-image" src="index.assets/animation.gif">
|
||||
</div>
|
||||
|
||||
<div class="intro-container">
|
||||
<img class="intro-image" src="index.assets/running_code.gif">
|
||||
<div class="intro-text">
|
||||
<div>
|
||||
<div style="display: flex; align-items: center;">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" height="1.5em" width="1.5em"
|
||||
viewBox="0 0 640 512"><!--!Font Awesome Free 6.5.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2023 Fonticons, Inc.-->
|
||||
<path fill="var(--md-primary-bg-color)"
|
||||
d="M392.8 1.2c-17-4.9-34.7 5-39.6 22l-128 448c-4.9 17 5 34.7 22 39.6s34.7-5 39.6-22l128-448c4.9-17-5-34.7-22-39.6zm80.6 120.1c-12.5 12.5-12.5 32.8 0 45.3L562.7 256l-89.4 89.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0l112-112c12.5-12.5 12.5-32.8 0-45.3l-112-112c-12.5-12.5-32.8-12.5-45.3 0zm-306.7 0c-12.5-12.5-32.8-12.5-45.3 0l-112 112c-12.5 12.5-12.5 32.8 0 45.3l112 112c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L77.3 256l89.4-89.4c12.5-12.5 12.5-32.8 0-45.3z" />
|
||||
</svg>
|
||||
<h3 style="margin-left: 0.5em;">一键运行</h3>
|
||||
</div>
|
||||
<p style="margin: 0;">十余种编程语言,代码可视化运行</p>
|
||||
<p class="intro-quote">"Talk is cheap. Show me the code."</br>“少吹牛,看代码”</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="intro-container">
|
||||
<div class="intro-text">
|
||||
<div>
|
||||
<div style="display: flex; align-items: center;">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" height="1.5em" width="1.5em"
|
||||
viewBox="0 0 640 512"><!--!Font Awesome Free 6.5.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2023 Fonticons, Inc.-->
|
||||
<path fill="var(--md-primary-bg-color)"
|
||||
d="M88.2 309.1c9.8-18.3 6.8-40.8-7.5-55.8C59.4 230.9 48 204 48 176c0-63.5 63.8-128 160-128s160 64.5 160 128s-63.8 128-160 128c-13.1 0-25.8-1.3-37.8-3.6c-10.4-2-21.2-.6-30.7 4.2c-4.1 2.1-8.3 4.1-12.6 6c-16 7.2-32.9 13.5-49.9 18c2.8-4.6 5.4-9.1 7.9-13.6c1.1-1.9 2.2-3.9 3.2-5.9zM0 176c0 41.8 17.2 80.1 45.9 110.3c-.9 1.7-1.9 3.5-2.8 5.1c-10.3 18.4-22.3 36.5-36.6 52.1c-6.6 7-8.3 17.2-4.6 25.9C5.8 378.3 14.4 384 24 384c43 0 86.5-13.3 122.7-29.7c4.8-2.2 9.6-4.5 14.2-6.8c15.1 3 30.9 4.5 47.1 4.5c114.9 0 208-78.8 208-176S322.9 0 208 0S0 78.8 0 176zM432 480c16.2 0 31.9-1.6 47.1-4.5c4.6 2.3 9.4 4.6 14.2 6.8C529.5 498.7 573 512 616 512c9.6 0 18.2-5.7 22-14.5c3.8-8.8 2-19-4.6-25.9c-14.2-15.6-26.2-33.7-36.6-52.1c-.9-1.7-1.9-3.4-2.8-5.1C622.8 384.1 640 345.8 640 304c0-94.4-87.9-171.5-198.2-175.8c4.1 15.2 6.2 31.2 6.2 47.8l0 .6c87.2 6.7 144 67.5 144 127.4c0 28-11.4 54.9-32.7 77.2c-14.3 15-17.3 37.6-7.5 55.8c1.1 2 2.2 4 3.2 5.9c2.5 4.5 5.2 9 7.9 13.6c-17-4.5-33.9-10.7-49.9-18c-4.3-1.9-8.5-3.9-12.6-6c-9.5-4.8-20.3-6.2-30.7-4.2c-12.1 2.4-24.7 3.6-37.8 3.6c-61.7 0-110-26.5-136.8-62.3c-16 5.4-32.8 9.4-50 11.8C279 439.8 350 480 432 480z" />
|
||||
</svg>
|
||||
<h3 style="margin-left: 0.5em;">互助学习</h3>
|
||||
</div>
|
||||
<p style="margin: 0;">欢迎讨论与提问,读者间携手共进</p>
|
||||
<p class="intro-quote">"Knowledge increases by sharing."</br>“知识在分享中得以增长”</p>
|
||||
</div>
|
||||
</div>
|
||||
<img class="intro-image" src="index.assets/comment.gif">
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- Section: contributors -->
|
||||
<section data-md-color-scheme="slate" data-md-color-primary="grey" class="home-div">
|
||||
<div class="section-content" style="max-width: 90vw;">
|
||||
<!-- author -->
|
||||
<div style="margin: 2em auto;">
|
||||
<h3>作者</h3>
|
||||
<div class="profile-div">
|
||||
<div class="profile-cell">
|
||||
<a href="https://github.com/krahets">
|
||||
<img class="profile-img" src="https://avatars.githubusercontent.com/u/26993056?v=4" alt="krahets" />
|
||||
<br><b>靳宇栋(@krahets)</b>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- reviewers -->
|
||||
<div style="margin: 2em auto;">
|
||||
<h3>代码审阅者</h3>
|
||||
<div class="profile-div">
|
||||
<div class="profile-cell">
|
||||
<a href="https://github.com/codingonion">
|
||||
<img class="profile-img" src="https://avatars.githubusercontent.com/u/99076655?v=4" alt="codingonion" />
|
||||
<br><b>codingonion</b>
|
||||
<br><sub>Zig, Rust</sub>
|
||||
</a>
|
||||
</div>
|
||||
<div class="profile-cell">
|
||||
<a href="https://github.com/Gonglja">
|
||||
<img class="profile-img" src="https://avatars.githubusercontent.com/u/39959756?v=4" alt="Gonglja" />
|
||||
<br><b>Gonglja</b>
|
||||
<br><sub>C, C++</sub>
|
||||
</a>
|
||||
</div>
|
||||
<div class="profile-cell">
|
||||
<a href="https://github.com/gvenusleo">
|
||||
<img class="profile-img" src="https://avatars.githubusercontent.com/u/79075347?v=4" alt="gvenusleo" />
|
||||
<br><b>gvenusleo</b>
|
||||
<br><sub>Dart</sub>
|
||||
</a>
|
||||
</div>
|
||||
<div class="profile-cell">
|
||||
<a href="https://github.com/hpstory">
|
||||
<img class="profile-img" src="https://avatars.githubusercontent.com/u/33348162?v=4" alt="hpstory" />
|
||||
<br><b>hpstory</b>
|
||||
<br><sub>C#</sub>
|
||||
</a>
|
||||
</div>
|
||||
<div class="profile-cell">
|
||||
<a href="https://github.com/justin-tse">
|
||||
<img class="profile-img" src="https://avatars.githubusercontent.com/u/24556310?v=4" alt="justin-tse" />
|
||||
<br><b>justin-tse</b>
|
||||
<br><sub>JS, TS</sub>
|
||||
</a>
|
||||
</div>
|
||||
<div class="profile-cell">
|
||||
<a href="https://github.com/krahets">
|
||||
<img class="profile-img" src="https://avatars.githubusercontent.com/u/26993056?v=4" alt="krahets" />
|
||||
<br><b>krahets</b>
|
||||
<br><sub>Python, Java</sub>
|
||||
</a>
|
||||
</div>
|
||||
<div class="profile-cell">
|
||||
<a href="https://github.com/night-cruise">
|
||||
<img class="profile-img" src="https://avatars.githubusercontent.com/u/77157236?v=4" alt="night-cruise" />
|
||||
<br><b>night-cruise</b>
|
||||
<br><sub>Rust</sub>
|
||||
</a>
|
||||
</div>
|
||||
<div class="profile-cell">
|
||||
<a href="https://github.com/nuomi1">
|
||||
<img class="profile-img" src="https://avatars.githubusercontent.com/u/3739017?v=4" alt="nuomi1" />
|
||||
<br><b>nuomi1</b>
|
||||
<br><sub>Swift</sub>
|
||||
</a>
|
||||
</div>
|
||||
<div class="profile-cell">
|
||||
<a href="https://github.com/Reanon">
|
||||
<img class="profile-img" src="https://avatars.githubusercontent.com/u/22005836?v=4" alt="Reanon" />
|
||||
<br><b>Reanon</b>
|
||||
<br><sub>Go, C</sub>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- contributors -->
|
||||
<div style="margin: 2em auto;">
|
||||
<h3>贡献者</h3>
|
||||
<p>本书在开源社区 130 多位贡献者的共同努力下不断完善,感谢他们付出的时间与精力!</p>
|
||||
<a href="https://github.com/krahets/hello-algo/graphs/contributors">
|
||||
<img src="https://contrib.rocks/image?repo=krahets/hello-algo" style="width: 100%; max-width: 830px;">
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
|
@ -216,3 +216,183 @@ body {
|
|||
transform-origin: top left;
|
||||
border: none;
|
||||
}
|
||||
|
||||
/* landing page container */
|
||||
.home-div {
|
||||
width: 100%;
|
||||
height: auto;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
background-color: var(--md-default-bg-color);
|
||||
color: var(--md-default-fg-color);
|
||||
font-size: 0.9rem;
|
||||
padding: 2em;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.section-content {
|
||||
width: 100%;
|
||||
height: auto;
|
||||
max-width: 70vw;
|
||||
}
|
||||
|
||||
.hero-btn {
|
||||
margin: 0 0.1em;
|
||||
padding: 0.5em 1.3em;
|
||||
font-size: 0.85em;
|
||||
}
|
||||
|
||||
/* hero image */
|
||||
.hero-image-div {
|
||||
height: min(84vh, 75vw);
|
||||
width: min(112vh, 100vw);
|
||||
margin: 0 auto;
|
||||
margin-top: -2.4rem;
|
||||
padding: 0;
|
||||
position: relative;
|
||||
color: white;
|
||||
font-size: min(2vh, 2.5vw);
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.hero-bg {
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
object-fit: cover;
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
/* hover on the planets */
|
||||
.hero-on-hover {
|
||||
width: auto;
|
||||
position: absolute;
|
||||
transition: transform 0.3s ease-in-out, filter 0.3s ease-in-out;
|
||||
}
|
||||
|
||||
.hero-caption {
|
||||
margin: 0;
|
||||
position: absolute;
|
||||
transform: translateX(-50%) translateY(-50%);
|
||||
}
|
||||
|
||||
a:hover .hero-on-hover {
|
||||
filter: brightness(1.2) saturate(1.1);
|
||||
transform: scale(1.03);
|
||||
}
|
||||
|
||||
a:hover .hero-caption {
|
||||
color: var(--md-typeset-btn-color);
|
||||
}
|
||||
|
||||
/* device */
|
||||
.device-on-hover {
|
||||
width: auto;
|
||||
position: absolute;
|
||||
transition: transform 0.3s ease-in-out;
|
||||
}
|
||||
|
||||
.device-on-hover:hover {
|
||||
transform: scale(1.03);
|
||||
}
|
||||
|
||||
/* brief intro */
|
||||
.intro-container {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin: 2em auto;
|
||||
}
|
||||
|
||||
.intro-image {
|
||||
flex-shrink: 0;
|
||||
flex-grow: 0;
|
||||
width: 55%;
|
||||
border-radius: 0.5em;
|
||||
box-shadow: var(--md-shadow-z2);
|
||||
}
|
||||
|
||||
.intro-text {
|
||||
flex-grow: 1; /* 允许元素填充剩余空间 */
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
text-align: left;
|
||||
align-items: flex-start;
|
||||
width: fit-content;
|
||||
margin: 2em;
|
||||
}
|
||||
|
||||
.intro-text > div {
|
||||
align-self: flex-start;
|
||||
width: auto;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
.intro-quote {
|
||||
color: var(--md-accent-fg-color);
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
/* contributors table */
|
||||
.profile-div {
|
||||
display: flex;
|
||||
flex-wrap: wrap; /* 当空间不足时换行 */
|
||||
justify-content: center; /* 居中对齐子元素 */
|
||||
max-width: 1080px; /* 或其他最大宽度 */
|
||||
margin: 1em auto;
|
||||
}
|
||||
|
||||
.profile-cell {
|
||||
flex: 1; /* 每个单元格均分空间 */
|
||||
flex-basis: 15%;
|
||||
margin: 1em 0.5em; /* 为了清晰间隔,可以根据需要调整 */
|
||||
text-align: center; /* 文本居中 */
|
||||
}
|
||||
|
||||
.profile-img {
|
||||
width: 5em;
|
||||
border-radius: 50%;
|
||||
margin-bottom: 0.2em;
|
||||
}
|
||||
|
||||
.contrib-image {
|
||||
width: 45%;
|
||||
}
|
||||
|
||||
/* Hide table of contents */
|
||||
@media screen and (max-width: 60em) {
|
||||
.home-div {
|
||||
font-size: 0.75rem;
|
||||
}
|
||||
}
|
||||
|
||||
/* Hide navigation */
|
||||
@media screen and (max-width: 76.25em) {
|
||||
.section-content {
|
||||
max-width: 95vw;
|
||||
}
|
||||
|
||||
.intro-container {
|
||||
flex-direction: column; /* 竖向布局 */
|
||||
}
|
||||
|
||||
.intro-text {
|
||||
width: auto;
|
||||
order: 2;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
.intro-image {
|
||||
width: 100%; /* 占满屏幕宽度 */
|
||||
order: 1;
|
||||
margin-bottom: 1em;
|
||||
}
|
||||
|
||||
.contrib-image {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.profile-cell {
|
||||
flex-basis: 25%;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue