This commit is contained in:
krahets
2023-04-09 05:30:47 +08:00
parent 37f11aff68
commit 2289822dfd
13 changed files with 59 additions and 58 deletions

View File

@@ -35,7 +35,7 @@ comments: true
=== "Python"
```python title="array.py"
""" 初始化数组 """
# 初始化数组
arr: List[int] = [0] * 5 # [ 0, 0, 0, 0, 0 ]
nums: List[int] = [1, 3, 2, 5, 4]
```
@@ -527,7 +527,7 @@ elementAddr = firtstElementAddr + elementLength * elementIndex
}
```
删除元素也类似,如果我们想要删除索引 $i$ 处的元素,则需要把索引 $i$ 之后的元素都向前移动一位。值得注意的是,删除元素后,原先末尾的元素变得“无意义”了,我们无需特意去修改它。
删除元素也类似,如果我们想要删除索引 $i$ 处的元素,则需要把索引 $i$ 之后的元素都向前移动一位。值得注意的是,删除元素后,原先末尾的元素变得“无意义”了,我们无需特意去修改它。
![数组删除元素](array.assets/array_remove_element.png)