Skip to content

Commit 301adcf

Browse files
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>
1 parent f47d371 commit 301adcf

1 file changed

Lines changed: 20 additions & 20 deletions

File tree

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,56 @@
11
# Algorithms are everywhere
22

3-
When we hear the word "algorithm," we naturally think of mathematics. However, many algorithms do not involve complex mathematics but rely more on basic logic, which can be seen everywhere in our daily lives.
3+
When we hear the term "algorithm," we naturally think of mathematics. However, many algorithms do not involve complex mathematics but rely more on basic logic, which can be seen everywhere in our daily lives.
44

5-
Before formally discussing algorithms, there's an interesting fact worth sharing: **you have already unconsciously learned many algorithms and have become accustomed to applying them in your daily life**. Here, I will give a few specific examples to prove this point.
5+
Before we start discussing about algorithms officially, there's an interesting fact worth sharing: **you've learned many algorithms unconsciously and are used to applying them in your daily life**. Here, I will give a few specific examples to prove this point.
66

7-
**Example 1: Looking Up a Dictionary**. In an English dictionary, words are listed alphabetically. Suppose we're searching for a word that starts with the letter $r$. This is typically done in the following way:
7+
**Example 1: Looking Up a Dictionary**. In an English dictionary, words are listed alphabetically. Assuming we're searching for a word that starts with the letter $r$, this is typically done in the following way:
88

9-
1. Open the dictionary to about halfway and check the first letter on the page, let's say the letter is $m$.
10-
2. Since $r$ comes after $m$ in the alphabet, we can ignore the first half of the dictionary and focus on the latter half.
9+
1. Open the dictionary to about halfway and check the first vocabulary of the page, let's say the letter starts with $m$.
10+
2. Since $r$ comes after $m$ in the alphabet, the first half can be ignored and the search space is narrowed down to the second half.
1111
3. Repeat steps `1.` and `2.` until you find the page where the word starts with $r$.
1212

1313
=== "<1>"
14-
![Process of Looking Up a Dictionary](algorithms_are_everywhere.assets/binary_search_dictionary_step1.png)
14+
![Process of looking up a dictionary](algorithms_are_everywhere.assets/binary_search_dictionary_step1.png)
1515

1616
=== "<2>"
17-
![Binary Search in Dictionary Step 2](algorithms_are_everywhere.assets/binary_search_dictionary_step2.png)
17+
![Binary search in dictionary step 2](algorithms_are_everywhere.assets/binary_search_dictionary_step2.png)
1818

1919
=== "<3>"
20-
![Binary Search in Dictionary Step 3](algorithms_are_everywhere.assets/binary_search_dictionary_step3.png)
20+
![Binary search in dictionary step 3](algorithms_are_everywhere.assets/binary_search_dictionary_step3.png)
2121

2222
=== "<4>"
23-
![Binary Search in Dictionary Step 4](algorithms_are_everywhere.assets/binary_search_dictionary_step4.png)
23+
![Binary search in dictionary step 4](algorithms_are_everywhere.assets/binary_search_dictionary_step4.png)
2424

2525
=== "<5>"
26-
![Binary Search in Dictionary Step 5](algorithms_are_everywhere.assets/binary_search_dictionary_step5.png)
26+
![Binary search in dictionary step 5](algorithms_are_everywhere.assets/binary_search_dictionary_step5.png)
2727

28-
Looking up a dictionary, a must-have skill for primary school students, is actually the famous "binary search" algorithm. From the perspective of data structure, we can regard the dictionary as a sorted "array"; from the perspective of algorithm, we can regard the above series of dictionary lookup operations as "binary search."
28+
Looking up a dictionary, an essential skill for elementary school students is actually the famous "Binary Search" algorithm. From a data structure perspective, we can consider the dictionary as a sorted "array"; from an algorithmic perspective, the series of actions taken to look up a word in the dictionary can be viewed as the algorithm "Binary Search."
2929

30-
**Example 2: Organizing Playing Cards**. When playing cards, we need to arrange the cards in our hand in ascending order, as shown in the following process.
30+
**Example 2: Organizing Card Deck**. When playing cards, we need to arrange the cards in our hands in ascending order, as shown in the following process.
3131

3232
1. Divide the playing cards into "ordered" and "unordered" sections, assuming initially the leftmost card is already in order.
3333
2. Take out a card from the unordered section and insert it into the correct position in the ordered section; after this, the leftmost two cards are in order.
3434
3. Repeat step `2` until all cards are in order.
3535

36-
![Playing cards sorting process](algorithms_are_everywhere.assets/playing_cards_sorting.png)
36+
![Process of sorting a deck of cards](algorithms_are_everywhere.assets/playing_cards_sorting.png)
3737

38-
The above method of organizing playing cards is essentially the "Insertion Sort" algorithm, which is very efficient for small datasets. Insertion sort is included in the sorting functions of many programming languages.
38+
The above method of organizing playing cards is practically the "Insertion Sort" algorithm, which is very efficient for small datasets. Many programming languages' sorting functions include the insertion sort.
3939

40-
**Example 3: Making Change**. Suppose we buy goods worth $69$ yuan at a supermarket and give the cashier $100$ yuan, then the cashier needs to give us $31$ yuan in change. They would naturally complete the thought process as shown in the figure below.
40+
**Example 3: Making Change**. Assume making a purchase of $69$ at a supermarket. If you give the cashier $100$, they will need to provide you with $31$ in change. This process can be clearly understood as illustrated in the figure below.
4141

42-
1. The options are currencies smaller than $31$, including $1$, $5$, $10$, and $20$.
42+
1. The options are currencies valued below $31$, including $1$, $5$, $10$, and $20$.
4343
2. Take out the largest $20$ from the options, leaving $31 - 20 = 11$.
4444
3. Take out the largest $10$ from the remaining options, leaving $11 - 10 = 1$.
4545
4. Take out the largest $1$ from the remaining options, leaving $1 - 1 = 0$.
46-
5. Complete the change-making, with the solution being $20 + 10 + 1 = 31$.
46+
5. Complete change-making, the solution is $20 + 10 + 1 = 31$.
4747

48-
![Change making process](algorithms_are_everywhere.assets/greedy_change.png)
48+
![Process of making change](algorithms_are_everywhere.assets/greedy_change.png)
4949

50-
In the above steps, we make the best choice at each step (using the largest denomination possible), ultimately resulting in a feasible change-making plan. From the perspective of data structures and algorithms, this method is essentially a "Greedy" algorithm.
50+
In the steps described, we choose the best option at each stage by utilizing the largest denomination available, which leads to an effective change-making strategy. From a data structures and algorithms perspective, this approach is known as a "Greedy" algorithm.
5151

5252
From cooking a meal to interstellar travel, almost all problem-solving involves algorithms. The advent of computers allows us to store data structures in memory and write code to call the CPU and GPU to execute algorithms. In this way, we can transfer real-life problems to computers and solve various complex issues in a more efficient way.
5353

5454
!!! tip
5555

56-
If concepts such as data structures, algorithms, arrays, and binary search still seem somewhat obscure, I encourage you to read on. This book will guide you step by step into the world of data structures and algorithms.
56+
If you are still confused about concepts like data structures, algorithms, arrays, and binary searches, I encourage you to keep reading. This book will gently guide you into the realm of understanding data structures and algorithms.

0 commit comments

Comments
 (0)