You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Add "reference" for EN version. Bug fixes.
* Unify the figure reference as "the figure below" and "the figure above".
Bug fixes.
* Format the EN markdown files.
* Replace "" with <u></u> for EN version and bug fixes
* Fix biary_tree_dfs.png
* Fix biary_tree_dfs.png
* Fix zh-hant/biary_tree_dfs.png
* Fix heap_sort_step1.png
* Sync zh and zh-hant versions.
* Bug fixes
* Fix EN figures
* Bug fixes
* Fix the figure labels for EN version
Images cannot be directly modified and require the creation of a new [Issue](https://github.com/krahets/hello-algo/issues) or a comment to describe the problem. We will redraw and replace the images as soon as possible.
23
+
Figures cannot be directly modified and require the creation of a new [Issue](https://github.com/krahets/hello-algo/issues) or a comment to describe the problem. We will redraw and replace the figures as soon as possible.
Copy file name to clipboardexpand all lines: en/docs/chapter_appendix/installation.md
+1-1
Original file line number
Diff line number
Diff line change
@@ -6,7 +6,7 @@ We recommend using the open-source, lightweight VS Code as your local Integrated
6
6
7
7

8
8
9
-
VS Code has a powerful extension ecosystem, supporting the execution and debugging of most programming languages. For example, after installing the "Python Extension Pack," you can debug Python code. The installation steps are shown in the following figure.
9
+
VS Code has a powerful extension ecosystem, supporting the execution and debugging of most programming languages. For example, after installing the "Python Extension Pack," you can debug Python code. The installation steps are shown in the figure below.
10
10
11
11

Copy file name to clipboardexpand all lines: en/docs/chapter_array_and_linkedlist/array.md
+3-3
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
# Array
2
2
3
-
An "array" is a linear data structure that operates as a lineup of similar items, stored together in a computer's memory in contiguous spaces. It's like a sequence that maintains organized storage. Each item in this lineup has its unique 'spot' known as an "index". Please refer to the figure below to observe how arrays work and grasp these key terms.
3
+
An <u>array</u> is a linear data structure that operates as a lineup of similar items, stored together in a computer's memory in contiguous spaces. It's like a sequence that maintains organized storage. Each item in this lineup has its unique 'spot' known as an <u>index</u>. Please refer to the figure below to observe how arrays work and grasp these key terms.
4
4
5
5

6
6
@@ -125,7 +125,7 @@ Elements in an array are stored in contiguous memory spaces, making it simpler t
125
125
126
126

127
127
128
-
As observed in the above illustration, array indexing conventionally begins at $0$. While this might appear counterintuitive, considering counting usually starts at $1$, within the address calculation formula, **an index is essentially an offset from the memory address**. For the first element's address, this offset is $0$, validating its index as $0$.
128
+
As observed in the figure above, array indexing conventionally begins at $0$. While this might appear counterintuitive, considering counting usually starts at $1$, within the address calculation formula, **an index is essentially an offset from the memory address**. For the first element's address, this offset is $0$, validating its index as $0$.
129
129
130
130
Accessing elements in an array is highly efficient, allowing us to randomly access any element in $O(1)$ time.
131
131
@@ -135,7 +135,7 @@ Accessing elements in an array is highly efficient, allowing us to randomly acce
135
135
136
136
### Inserting elements
137
137
138
-
Array elements are tightly packed in memory, with no space available to accommodate additional data between them. Illustrated in Figure below, inserting an element in the middle of an array requires shifting all subsequent elements back by one position to create room for the new element.
138
+
Array elements are tightly packed in memory, with no space available to accommodate additional data between them. As illustrated in the figure below, inserting an element in the middle of an array requires shifting all subsequent elements back by one position to create room for the new element.
139
139
140
140

Copy file name to clipboardexpand all lines: en/docs/chapter_array_and_linkedlist/linked_list.md
+5-5
Original file line number
Diff line number
Diff line change
@@ -2,13 +2,13 @@
2
2
3
3
Memory space is a shared resource among all programs. In a complex system environment, available memory can be dispersed throughout the memory space. We understand that the memory allocated for an array must be continuous. However, for very large arrays, finding a sufficiently large contiguous memory space might be challenging. This is where the flexible advantage of linked lists becomes evident.
4
4
5
-
A "linked list" is a linear data structure in which each element is a node object, and the nodes are interconnected through "references". These references hold the memory addresses of subsequent nodes, enabling navigation from one node to the next.
5
+
A <u>linked list</u> is a linear data structure in which each element is a node object, and the nodes are interconnected through "references". These references hold the memory addresses of subsequent nodes, enabling navigation from one node to the next.
6
6
7
7
The design of linked lists allows for their nodes to be distributed across memory locations without requiring contiguous memory addresses.
8
8
9
9

10
10
11
-
As shown in the figure, we see that the basic building block of a linked list is the "node" object. Each node comprises two key components: the node's "value" and a "reference" to the next node.
11
+
As shown in the figure above, we see that the basic building block of a linked list is the <u>node</u> object. Each node comprises two key components: the node's "value" and a "reference" to the next node.
12
12
13
13
- The first node in a linked list is the "head node", and the final one is the "tail node".
14
14
- The tail node points to "null", designated as `null` in Java, `nullptr` in C++, and `None` in Python.
@@ -406,7 +406,7 @@ The array as a whole is a variable, for instance, the array `nums` includes elem
406
406
407
407
### Inserting nodes
408
408
409
-
Inserting a node into a linked list is very easy. As shown in the figure, let's assume we aim to insert a new node `P` between two adjacent nodes `n0` and `n1`. **This can be achieved by simply modifying two node references (pointers)**, with a time complexity of $O(1)$.
409
+
Inserting a node into a linked list is very easy. As shown in the figure below, let's assume we aim to insert a new node `P` between two adjacent nodes `n0` and `n1`. **This can be achieved by simply modifying two node references (pointers)**, with a time complexity of $O(1)$.
410
410
411
411
By comparison, inserting an element into an array has a time complexity of $O(n)$, which becomes less efficient when dealing with large data volumes.
412
412
@@ -418,7 +418,7 @@ By comparison, inserting an element into an array has a time complexity of $O(n)
418
418
419
419
### Deleting nodes
420
420
421
-
As shown in the figure, deleting a node from a linked list is also very easy, **involving only the modification of a single node's reference (pointer)**.
421
+
As shown in the figure below, deleting a node from a linked list is also very easy, **involving only the modification of a single node's reference (pointer)**.
422
422
423
423
It's important to note that even though node `P` continues to point to `n1` after being deleted, it becomes inaccessible during linked list traversal. This effectively means that `P` is no longer a part of the linked list.
424
424
@@ -461,7 +461,7 @@ The table below summarizes the characteristics of arrays and linked lists, and i
461
461
462
462
## Common types of linked lists
463
463
464
-
As shown in the figure, there are three common types of linked lists.
464
+
As shown in the figure below, there are three common types of linked lists.
465
465
466
466
-**Singly linked list**: This is the standard linked list described earlier. Nodes in a singly linked list include a value and a reference to the next node. The first node is known as the head node, and the last node, which points to null (`None`), is the tail node.
467
467
-**Circular linked list**: This is formed when the tail node of a singly linked list points back to the head node, creating a loop. In a circular linked list, any node can function as the head node.
Copy file name to clipboardexpand all lines: en/docs/chapter_array_and_linkedlist/list.md
+2-2
Original file line number
Diff line number
Diff line change
@@ -1,13 +1,13 @@
1
1
# List
2
2
3
-
A "list" is an abstract data structure concept that represents an ordered collection of elements, supporting operations such as element access, modification, addition, deletion, and traversal, without requiring users to consider capacity limitations. Lists can be implemented based on linked lists or arrays.
3
+
A <u>list</u> is an abstract data structure concept that represents an ordered collection of elements, supporting operations such as element access, modification, addition, deletion, and traversal, without requiring users to consider capacity limitations. Lists can be implemented based on linked lists or arrays.
4
4
5
5
- A linked list inherently serves as a list, supporting operations for adding, deleting, searching, and modifying elements, with the flexibility to dynamically adjust its size.
6
6
- Arrays also support these operations, but due to their immutable length, they can be considered as a list with a length limit.
7
7
8
8
When implementing lists using arrays, **the immutability of length reduces the practicality of the list**. This is because predicting the amount of data to be stored in advance is often challenging, making it difficult to choose an appropriate list length. If the length is too small, it may not meet the requirements; if too large, it may waste memory space.
9
9
10
-
To solve this problem, we can implement lists using a "dynamic array." It inherits the advantages of arrays and can dynamically expand during program execution.
10
+
To solve this problem, we can implement lists using a <u>dynamic array</u>. It inherits the advantages of arrays and can dynamically expand during program execution.
11
11
12
12
In fact, **many programming languages' standard libraries implement lists using dynamic arrays**, such as Python's `list`, Java's `ArrayList`, C++'s `vector`, and C#'s `List`. In the following discussion, we will consider "list" and "dynamic array" as synonymous concepts.
0 commit comments