mirror of
https://github.com/krahets/hello-algo.git
synced 2024-12-28 11:06:27 +08:00
46813a5247
* Translate 1.0.0b6 release with the machine learning translator. * Update Dockerfile A few translation improvements. * Fix a badge logo. * Fix EN translation of chapter_appendix/terminology.md (#913) * Update README.md * Update README.md * translation: Refined the automated translation of README (#932) * refined the automated translation of README * Update index.md * Update mkdocs-en.yml --------- Co-authored-by: Yudong Jin <krahets@163.com> * translate: Embellish chapter_computational_complexity/index.md (#940) * translation: Update chapter_computational_complexity/performance_evaluation.md (#943) * Update performance_evaluation.md * Update performance_evaluation.md * Update performance_evaluation.md change 'methods' to 'approaches' on line 15 * Update performance_evaluation.md on line 21, change the sentence to 'the results could be the opposite on another computer with different specifications.' * Update performance_evaluation.md delete two short sentence on line 5 and 6 * Update performance_evaluation.md change `unavoidable` to `inevitable` on line 48 * Update performance_evaluation.md small changes on line 23 * translation: Update terminology and improve readability in preface summary (#954) * Update terminology and improve readability in preface summary This commit made a few adjustments in the 'summary.md' file for clearer and more accessible language. "Brushing tool library" was replaced with "Coding Toolkit" to better reflect common terminology. Also, advice for beginners in algorithm learning journey was reformulated to imply a more positive approach avoiding detours and common pitfalls. The section related to the discussion forum was rewritten to sound more inviting to readers. * Format * Optimize the translation of chapter_introduction/algorithms_are_everywhere. * Add .gitignore to Java subfolder. * Update the button assets. * Fix the callout * translation: chapter_computational_complexity/summary to en (#953) * translate chapter_computational_complexity/summary * minor format * Update summary.md with comment * Update summary.md * Update summary.md * translation: chapter_introduction/what_is_dsa.md (#962) * Optimize translation of what_is_dsa.md * Update * translation: chapter_introduction/summary.md (#963) * Translate chapter_introduction/summary.md * Update * translation: Update README.md (#964) * Update en translation of README.md * Update README.md * translation: update space_complexity.md (#970) * update space_complexity.md * the rest of translation piece * Update space_complexity.md --------- Co-authored-by: ThomasQiu <thomas.qiu@mnfgroup.limited> Co-authored-by: Yudong Jin <krahets@163.com> * translation: Update chapter_introduction/index.md (#971) * Update index.md sorry, first time doing this... now this is the final change. changes: title of the chapter is shorter. refined the abstract. * Update index.md --------- Co-authored-by: Yudong Jin <krahets@163.com> * translation: Update chapter_data_structure/classification_of_data_structure.md (#980) * update classification_of_data_structure.md * Update classification_of_data_structure.md --------- Co-authored-by: Yudong Jin <krahets@163.com> * translation: Update chapter_introduction/algorithms_are_everywhere.md (#972) * Update algorithms_are_everywhere.md changed or refined parts of the words and sentences including tips. Some of them I didnt change that much because im worried that it might not meet the requirement of accuracy. some other ones i changed a lot to make it sound better, but also kind of following the same wording as the CN version * Update algorithms_are_everywhere.md re-edited the dictionary part from Piyin to just normal Eng dictionary. again thank you very much hpstory for you suggestion. * Update algorithms_are_everywhere.md --------- Co-authored-by: Yudong Jin <krahets@163.com> * Prepare merging into main branch. * Update buttons * Update Dockerfile * Update index.md * Update index.md * Update README * Fix index.md * Fix mkdocs-en.yml --------- Co-authored-by: Yuelin Xin <sc20yx2@leeds.ac.uk> Co-authored-by: Phoenix Xie <phoenixx0415@gmail.com> Co-authored-by: Sizhuo Long <longsizhuo@gmail.com> Co-authored-by: Spark <qizhang94@outlook.com> Co-authored-by: Thomas <thomasqiu7@gmail.com> Co-authored-by: ThomasQiu <thomas.qiu@mnfgroup.limited> Co-authored-by: K3v123 <123932560+K3v123@users.noreply.github.com> Co-authored-by: Jin <36914748+yanedie@users.noreply.github.com>
224 lines
8.5 KiB
Markdown
224 lines
8.5 KiB
Markdown
# How To Read
|
|
|
|
!!! tip
|
|
|
|
For the best reading experience, it is recommended that you read through this section.
|
|
|
|
## Conventions Of Style
|
|
|
|
- Those labeled `*` after the title are optional chapters with relatively difficult content. If you have limited time, it is advisable to skip them.
|
|
- Proper nouns and words and phrases with specific meanings are marked with `"double quotes"` to avoid ambiguity.
|
|
- Important proper nouns and their English translations are marked with `" "` in parentheses, e.g. `"array array"` . It is recommended to memorize them for reading the literature.
|
|
- **Bolded text** Indicates key content or summary statements, which deserve special attention.
|
|
- When it comes to terms that are inconsistent between programming languages, this book follows Python, for example using $\text{None}$ to mean "empty".
|
|
- This book partially abandons the specification of annotations in programming languages in exchange for a more compact layout of the content. There are three main types of annotations: title annotations, content annotations, and multi-line annotations.
|
|
|
|
=== "Python"
|
|
|
|
```python title=""
|
|
"""Header comments for labeling functions, classes, test samples, etc.""""
|
|
|
|
# Content comments for detailed code solutions
|
|
|
|
"""
|
|
multi-line
|
|
marginal notes
|
|
"""
|
|
```
|
|
|
|
=== "C++"
|
|
|
|
```cpp title=""
|
|
/* Header comments for labeling functions, classes, test samples, etc. */
|
|
|
|
// Content comments for detailed code solutions.
|
|
|
|
/**
|
|
* multi-line
|
|
* marginal notes
|
|
*/
|
|
```
|
|
|
|
=== "Java"
|
|
|
|
```java title=""
|
|
/* Header comments for labeling functions, classes, test samples, etc. */
|
|
|
|
// Content comments for detailed code solutions.
|
|
|
|
/**
|
|
* multi-line
|
|
* marginal notes
|
|
*/
|
|
```
|
|
|
|
=== "C#"
|
|
|
|
```csharp title=""
|
|
/* Header comments for labeling functions, classes, test samples, etc. */
|
|
|
|
// Content comments for detailed code solutions.
|
|
|
|
/**
|
|
* multi-line
|
|
* marginal notes
|
|
*/
|
|
```
|
|
|
|
=== "Go"
|
|
|
|
```go title=""
|
|
/* Header comments for labeling functions, classes, test samples, etc. */
|
|
|
|
// Content comments for detailed code solutions.
|
|
|
|
/**
|
|
* multi-line
|
|
* marginal notes
|
|
*/
|
|
```
|
|
|
|
=== "Swift"
|
|
|
|
```swift title=""
|
|
/* Header comments for labeling functions, classes, test samples, etc. */
|
|
|
|
// Content comments for detailed code solutions.
|
|
|
|
/**
|
|
* multi-line
|
|
* marginal notes
|
|
*/
|
|
```
|
|
|
|
=== "JS"
|
|
|
|
```javascript title=""
|
|
/* Header comments for labeling functions, classes, test samples, etc. */
|
|
|
|
// Content comments for detailed code solutions.
|
|
|
|
/**
|
|
* multi-line
|
|
* marginal notes
|
|
*/
|
|
```
|
|
|
|
=== "TS"
|
|
|
|
```typescript title=""
|
|
/* Header comments for labeling functions, classes, test samples, etc. */
|
|
|
|
// Content comments for detailed code solutions.
|
|
|
|
/**
|
|
* multi-line
|
|
* marginal notes
|
|
*/
|
|
```
|
|
|
|
=== "Dart"
|
|
|
|
```dart title=""
|
|
/* Header comments for labeling functions, classes, test samples, etc. */
|
|
|
|
// Content comments for detailed code solutions.
|
|
|
|
/**
|
|
* multi-line
|
|
* marginal notes
|
|
*/
|
|
```
|
|
|
|
=== "Rust"
|
|
|
|
```rust title=""
|
|
/* Header comments for labeling functions, classes, test samples, etc. */
|
|
|
|
// Content comments for detailed code solutions.
|
|
|
|
/**
|
|
* multi-line
|
|
* marginal notes
|
|
*/
|
|
```
|
|
|
|
=== "C"
|
|
|
|
```c title=""
|
|
/* Header comments for labeling functions, classes, test samples, etc. */
|
|
|
|
// Content comments for detailed code solutions.
|
|
|
|
/**
|
|
* multi-line
|
|
* marginal notes
|
|
*/
|
|
```
|
|
|
|
=== "Zig"
|
|
|
|
```zig title=""
|
|
// Header comments for labeling functions, classes, test samples, etc.
|
|
|
|
// Content comments for detailed code solutions.
|
|
|
|
// Multi-line
|
|
// Annotation
|
|
```
|
|
|
|
## Learn Efficiently In Animated Graphic Solutions
|
|
|
|
Compared with text, videos and pictures have a higher degree of information density and structure and are easier to understand. In this book, **key and difficult knowledge will be presented mainly in the form of animations and graphs**, while the text serves as an explanation and supplement to the animations and graphs.
|
|
|
|
If, while reading the book, you find that a particular paragraph provides an animation or a graphic solution as shown below, **please use the figure as the primary source and the text as a supplement and synthesize the two to understand the content**.
|
|
|
|
![Example animation](../index.assets/animation.gif)
|
|
|
|
## Deeper Understanding In Code Practice
|
|
|
|
The companion code for this book is hosted in the [GitHub repository](https://github.com/krahets/hello-algo). As shown in the figure below, **the source code is accompanied by test samples that can be run with a single click**.
|
|
|
|
If time permits, **it is recommended that you refer to the code and knock it through on your own**. If you have limited time to study, please read through and run all the code at least once.
|
|
|
|
The process of writing code is often more rewarding than reading it. **Learning by doing is really learning**.
|
|
|
|
![Running code example](../index.assets/running_code.gif)
|
|
|
|
The preliminaries for running the code are divided into three main steps.
|
|
|
|
**Step 1: Install the local programming environment**. Please refer to [Appendix Tutorial](https://www.hello-algo.com/chapter_appendix/installation/) for installation, or skip this step if already installed.
|
|
|
|
**Step 2: Clone or download the code repository**. If [Git](https://git-scm.com/downloads) is already installed, you can clone this repository with the following command.
|
|
|
|
```shell
|
|
git clone https://github.com/krahets/hello-algo.git
|
|
```
|
|
|
|
Of course, you can also in the location shown in the figure below, click "Download ZIP" directly download the code zip, and then in the local solution.
|
|
|
|
![Clone repository with download code](suggestions.assets/download_code.png)
|
|
|
|
**Step 3: Run the source code**. As shown in the figure below, for the code block labeled with the file name at the top, we can find the corresponding source code file in the `codes` folder of the repository. The source code files can be run with a single click, which will help you save unnecessary debugging time and allow you to focus on what you are learning.
|
|
|
|
![Code block with corresponding source file](suggestions.assets/code_md_to_repo.png)
|
|
|
|
## Growing Together In Questioning And Discussion
|
|
|
|
While reading this book, please don't skip over the points that you didn't learn. **Feel free to ask your questions in the comment section**. We will be happy to answer them and can usually respond within two days.
|
|
|
|
As you can see in the figure below, each post comes with a comment section at the bottom. I hope you'll pay more attention to the comments section. On the one hand, you can learn about the problems that people encounter, so as to check the gaps and stimulate deeper thinking. On the other hand, we expect you to generously answer other partners' questions, share your insights, and help others improve.
|
|
|
|
![Example of comment section](../index.assets/comment.gif)
|
|
|
|
## Algorithm Learning Route
|
|
|
|
From a general point of view, we can divide the process of learning data structures and algorithms into three stages.
|
|
|
|
1. **Introduction to Algorithms**. We need to familiarize ourselves with the characteristics and usage of various data structures and learn about the principles, processes, uses and efficiency of different algorithms.
|
|
2. **Brush up on algorithm questions**. It is recommended to start brushing from popular topics, such as [Sword to Offer](https://leetcode.cn/studyplan/coding-interviews/) and [LeetCode Hot 100](https://leetcode.cn/studyplan/top-100- liked/), first accumulate at least 100 questions to familiarize yourself with mainstream algorithmic problems. Forgetfulness can be a challenge when first brushing up, but rest assured that this is normal. We can follow the "Ebbinghaus Forgetting Curve" to review the questions, and usually after 3-5 rounds of repetitions, we will be able to memorize them.
|
|
3. **Build the knowledge system**. In terms of learning, we can read algorithm column articles, solution frameworks and algorithm textbooks to continuously enrich the knowledge system. In terms of brushing, we can try to adopt advanced brushing strategies, such as categorizing by topic, multiple solutions, multiple solutions, etc. Related brushing tips can be found in various communities.
|
|
|
|
As shown in the figure below, this book mainly covers "Phase 1" and is designed to help you start Phase 2 and 3 more efficiently.
|
|
|
|
![algorithm learning route](suggestions.assets/learning_route.png)
|