mirror of
https://github.com/krahets/hello-algo.git
synced 2026-07-16 11:02:09 +08:00
build
This commit is contained in:
@@ -45,7 +45,7 @@ This essential skill for elementary students, looking up a dictionary, is actual
|
||||
|
||||
The above method of organizing playing cards is essentially the "Insertion Sort" algorithm, which is very efficient for small datasets. Many programming languages' sorting functions include the insertion sort.
|
||||
|
||||
**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 below.
|
||||
**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 Figure 1-3.
|
||||
|
||||
1. The options are currencies smaller than $31$, including $1$, $5$, $10$, and $20$.
|
||||
2. Take out the largest $20$ from the options, leaving $31 - 20 = 11$.
|
||||
|
||||
@@ -27,7 +27,7 @@ A "data structure" is a way of organizing and storing data in a computer, with t
|
||||
|
||||
## 1.2.3 Relationship between data structures and algorithms
|
||||
|
||||
As shown in the Figure 1-4 , data structures and algorithms are highly related and closely integrated, specifically in the following three aspects:
|
||||
As shown in Figure 1-4, data structures and algorithms are highly related and closely integrated, specifically in the following three aspects:
|
||||
|
||||
- Data structures are the foundation of algorithms. They provide structured data storage and methods for manipulating data for algorithms.
|
||||
- Algorithms are the stage where data structures come into play. The data structure alone only stores data information; it is through the application of algorithms that specific problems can be solved.
|
||||
@@ -37,13 +37,13 @@ As shown in the Figure 1-4 , data structures and algorithms are highly related a
|
||||
|
||||
<p align="center"> Figure 1-4 Relationship between data structures and algorithms </p>
|
||||
|
||||
Data structures and algorithms can be likened to a set of building blocks, as illustrated in the Figure 1-5 . A building block set includes numerous pieces, accompanied by detailed assembly instructions. Following these instructions step by step allows us to construct an intricate block model.
|
||||
Data structures and algorithms can be likened to a set of building blocks, as illustrated in Figure 1-5. A building block set includes numerous pieces, accompanied by detailed assembly instructions. Following these instructions step by step allows us to construct an intricate block model.
|
||||
|
||||
{ class="animation-figure" }
|
||||
|
||||
<p align="center"> Figure 1-5 Assembling blocks </p>
|
||||
|
||||
The detailed correspondence between the two is shown in the Table 1-1 .
|
||||
The detailed correspondence between the two is shown in Table 1-1.
|
||||
|
||||
<p align="center"> Table 1-1 Comparing data structures and algorithms to building blocks </p>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user