This commit is contained in:
krahets
2024-05-01 07:30:15 +08:00
parent 85f0bc4ed1
commit d246e08cc6
68 changed files with 220 additions and 220 deletions
@@ -3557,7 +3557,7 @@
<p align="center"> Figure 1-2 &nbsp; Playing cards sorting process </p>
<p>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.</p>
<p><strong>Example 3: Making Change</strong>. Suppose we buy goods worth <span class="arithmatex">\(69\)</span> yuan at a supermarket and give the cashier <span class="arithmatex">\(100\)</span> yuan, then the cashier needs to give us <span class="arithmatex">\(31\)</span> yuan in change. They would naturally complete the thought process as shown below.</p>
<p><strong>Example 3: Making Change</strong>. Suppose we buy goods worth <span class="arithmatex">\(69\)</span> yuan at a supermarket and give the cashier <span class="arithmatex">\(100\)</span> yuan, then the cashier needs to give us <span class="arithmatex">\(31\)</span> yuan in change. They would naturally complete the thought process as shown in Figure 1-3.</p>
<ol>
<li>The options are currencies smaller than <span class="arithmatex">\(31\)</span>, including <span class="arithmatex">\(1\)</span>, <span class="arithmatex">\(5\)</span>, <span class="arithmatex">\(10\)</span>, and <span class="arithmatex">\(20\)</span>.</li>
<li>Take out the largest <span class="arithmatex">\(20\)</span> from the options, leaving <span class="arithmatex">\(31 - 20 = 11\)</span>.</li>
@@ -3629,7 +3629,7 @@
<li>Graphs, compared to linked lists, provide richer logical information but require more memory space.</li>
</ul>
<h2 id="123-relationship-between-data-structures-and-algorithms">1.2.3 &nbsp; Relationship between data structures and algorithms<a class="headerlink" href="#123-relationship-between-data-structures-and-algorithms" title="Permanent link">&para;</a></h2>
<p>As shown in the Figure 1-4 , data structures and algorithms are highly related and closely integrated, specifically in the following three aspects:</p>
<p>As shown in Figure 1-4, data structures and algorithms are highly related and closely integrated, specifically in the following three aspects:</p>
<ul>
<li>Data structures are the foundation of algorithms. They provide structured data storage and methods for manipulating data for algorithms.</li>
<li>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.</li>
@@ -3638,11 +3638,11 @@
<p><a class="glightbox" href="../what_is_dsa.assets/relationship_between_data_structure_and_algorithm.png" data-type="image" data-width="100%" data-height="auto" data-desc-position="bottom"><img alt="Relationship between data structures and algorithms" class="animation-figure" src="../what_is_dsa.assets/relationship_between_data_structure_and_algorithm.png" /></a></p>
<p align="center"> Figure 1-4 &nbsp; Relationship between data structures and algorithms </p>
<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.</p>
<p>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.</p>
<p><a class="glightbox" href="../what_is_dsa.assets/assembling_blocks.png" data-type="image" data-width="100%" data-height="auto" data-desc-position="bottom"><img alt="Assembling blocks" class="animation-figure" src="../what_is_dsa.assets/assembling_blocks.png" /></a></p>
<p align="center"> Figure 1-5 &nbsp; Assembling blocks </p>
<p>The detailed correspondence between the two is shown in the Table 1-1 .</p>
<p>The detailed correspondence between the two is shown in Table 1-1.</p>
<p align="center"> Table 1-1 &nbsp; Comparing data structures and algorithms to building blocks </p>
<div class="center-table">