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

View File

@@ -3594,7 +3594,7 @@
<p>Common data structures include arrays, linked lists, stacks, queues, hash tables, trees, heaps, and graphs. They can be classified into "logical structure" and "physical structure".</p>
<h2 id="311-logical-structure-linear-and-non-linear">3.1.1 &nbsp; Logical structure: linear and non-linear<a class="headerlink" href="#311-logical-structure-linear-and-non-linear" title="Permanent link">&para;</a></h2>
<p><strong>The logical structures reveal the logical relationships between data elements</strong>. In arrays and linked lists, data are arranged in a specific sequence, demonstrating the linear relationship between data; while in trees, data are arranged hierarchically from the top down, showing the derived relationship between "ancestors" and "descendants"; and graphs are composed of nodes and edges, reflecting the intricate network relationship.</p>
<p>As shown in the Figure 3-1 , logical structures can be divided into two major categories: "linear" and "non-linear". Linear structures are more intuitive, indicating data is arranged linearly in logical relationships; non-linear structures, conversely, are arranged non-linearly.</p>
<p>As shown in Figure 3-1, logical structures can be divided into two major categories: "linear" and "non-linear". Linear structures are more intuitive, indicating data is arranged linearly in logical relationships; non-linear structures, conversely, are arranged non-linearly.</p>
<ul>
<li><strong>Linear data structures</strong>: Arrays, Linked Lists, Stacks, Queues, Hash Tables.</li>
<li><strong>Non-linear data structures</strong>: Trees, Heaps, Graphs, Hash Tables.</li>
@@ -3609,8 +3609,8 @@
<li><strong>Network structures</strong>: Graphs, where elements have a many-to-many relationships.</li>
</ul>
<h2 id="312-physical-structure-contiguous-and-dispersed">3.1.2 &nbsp; Physical structure: contiguous and dispersed<a class="headerlink" href="#312-physical-structure-contiguous-and-dispersed" title="Permanent link">&para;</a></h2>
<p><strong>During the execution of an algorithm, the data being processed is stored in memory</strong>. The Figure 3-2 shows a computer memory stick where each black square is a physical memory space. We can think of memory as a vast Excel spreadsheet, with each cell capable of storing a certain amount of data.</p>
<p><strong>The system accesses the data at the target location by means of a memory address</strong>. As shown in the Figure 3-2 , the computer assigns a unique identifier to each cell in the table according to specific rules, ensuring that each memory space has a unique memory address. With these addresses, the program can access the data stored in memory.</p>
<p><strong>During the execution of an algorithm, the data being processed is stored in memory</strong>. Figure 3-2 shows a computer memory stick where each black square is a physical memory space. We can think of memory as a vast Excel spreadsheet, with each cell capable of storing a certain amount of data.</p>
<p><strong>The system accesses the data at the target location by means of a memory address</strong>. As shown in Figure 3-2, the computer assigns a unique identifier to each cell in the table according to specific rules, ensuring that each memory space has a unique memory address. With these addresses, the program can access the data stored in memory.</p>
<p><a class="glightbox" href="../classification_of_data_structure.assets/computer_memory_location.png" data-type="image" data-width="100%" data-height="auto" data-desc-position="bottom"><img alt="Memory stick, memory spaces, memory addresses" class="animation-figure" src="../classification_of_data_structure.assets/computer_memory_location.png" /></a></p>
<p align="center"> Figure 3-2 &nbsp; Memory stick, memory spaces, memory addresses </p>
@@ -3619,7 +3619,7 @@
<p>It's worth noting that comparing memory to an Excel spreadsheet is a simplified analogy. The actual working mechanism of memory is more complex, involving concepts like address space, memory management, cache mechanisms, virtual memory, and physical memory.</p>
</div>
<p>Memory is a shared resource for all programs. When a block of memory is occupied by one program, it cannot be simultaneously used by other programs. <strong>Therefore, considering memory resources is crucial in designing data structures and algorithms</strong>. For instance, the algorithm's peak memory usage should not exceed the remaining free memory of the system; if there is a lack of contiguous memory blocks, then the data structure chosen must be able to be stored in non-contiguous memory blocks.</p>
<p>As illustrated in the Figure 3-3 , <strong>the physical structure reflects the way data is stored in computer memory</strong> and it can be divided into contiguous space storage (arrays) and non-contiguous space storage (linked lists). The two types of physical structures exhibit complementary characteristics in terms of time efficiency and space efficiency.</p>
<p>As illustrated in Figure 3-3, <strong>the physical structure reflects the way data is stored in computer memory</strong> and it can be divided into contiguous space storage (arrays) and non-contiguous space storage (linked lists). The two types of physical structures exhibit complementary characteristics in terms of time efficiency and space efficiency.</p>
<p><a class="glightbox" href="../classification_of_data_structure.assets/classification_phisical_structure.png" data-type="image" data-width="100%" data-height="auto" data-desc-position="bottom"><img alt="Contiguous space storage and dispersed space storage" class="animation-figure" src="../classification_of_data_structure.assets/classification_phisical_structure.png" /></a></p>
<p align="center"> Figure 3-3 &nbsp; Contiguous space storage and dispersed space storage </p>