mirror of
https://github.com/krahets/hello-algo.git
synced 2026-07-08 13:36:06 +00:00
build
This commit is contained in:
@@ -15,16 +15,15 @@ As shown in Figure 3-1, logical structures can be divided into two major categor
|
||||
- **Linear data structures**: Arrays, Linked Lists, Stacks, Queues, Hash Tables.
|
||||
- **Non-linear data structures**: Trees, Heaps, Graphs, Hash Tables.
|
||||
|
||||
Non-linear data structures can be further divided into tree structures and network structures.
|
||||
|
||||
- **Tree structures**: Trees, Heaps, Hash Tables, where elements have a one-to-many relationship.
|
||||
- **Network structures**: Graphs, where elements have a many-to-many relationships.
|
||||
|
||||
{ class="animation-figure" }
|
||||
|
||||
<p align="center"> Figure 3-1 Linear and non-linear data structures </p>
|
||||
|
||||
Non-linear data structures can be further divided into tree structures and network structures.
|
||||
|
||||
- **Linear structures**: Arrays, linked lists, queues, stacks, and hash tables, where elements have a one-to-one sequential relationship.
|
||||
- **Tree structures**: Trees, Heaps, Hash Tables, where elements have a one-to-many relationship.
|
||||
- **Network structures**: Graphs, where elements have a many-to-many relationships.
|
||||
|
||||
## 3.1.2 Physical structure: contiguous and dispersed
|
||||
|
||||
**During the execution of an algorithm, the data being processed is stored in memory**. 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.
|
||||
@@ -48,6 +47,7 @@ As illustrated in Figure 3-3, **the physical structure reflects the way data is
|
||||
<p align="center"> Figure 3-3 Contiguous space storage and dispersed space storage </p>
|
||||
|
||||
**It is worth noting that all data structures are implemented based on arrays, linked lists, or a combination of both**. For example, stacks and queues can be implemented using either arrays or linked lists; while implementations of hash tables may involve both arrays and linked lists.
|
||||
|
||||
- **Array-based implementations**: Stacks, Queues, Hash Tables, Trees, Heaps, Graphs, Matrices, Tensors (arrays with dimensions $\geq 3$).
|
||||
- **Linked-list-based implementations**: Stacks, Queues, Hash Tables, Trees, Heaps, Graphs, etc.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user