Update source codes.

This commit is contained in:
Yudong Jin
2022-12-20 13:20:20 +08:00
parent 030042e689
commit a8fb1a4f41
7 changed files with 7 additions and 7 deletions

View File

@ -358,7 +358,7 @@ elementAddr = firtstElementAddr + elementLength * elementIndex
""" 在数组的索引 index 处插入元素 num """
def insert(nums, num, index):
# 把索引 index 以及之后的所有元素向后移动一位
for i in range(len(nums) - 1, index , -1):
for i in range(len(nums) - 1, index, -1):
nums[i] = nums[i - 1]
# 将 num 赋给 index 处元素
nums[index] = num