From 0c24343ad79477cc33274548927ac4e22204fe73 Mon Sep 17 00:00:00 2001 From: Yudong Jin Date: Sun, 27 Nov 2022 20:00:03 +0800 Subject: [PATCH] Add an imortant tip. --- codes/python/chapter_array_and_linkedlist/array.py | 2 ++ docs/chapter_array_and_linkedlist/array.md | 2 ++ 2 files changed, 4 insertions(+) diff --git a/codes/python/chapter_array_and_linkedlist/array.py b/codes/python/chapter_array_and_linkedlist/array.py index 826c3bd..bdfc542 100644 --- a/codes/python/chapter_array_and_linkedlist/array.py +++ b/codes/python/chapter_array_and_linkedlist/array.py @@ -17,6 +17,8 @@ def randomAccess(nums): return random_num """ 扩展数组长度 """ +# 请注意,Python 的 list 是动态数组,可以直接扩展 +# 为了方便学习,本函数将 list 看作是长度不可变的数组 def extend(nums, enlarge): # 初始化一个扩展长度后的数组 res = [0] * (len(nums) + enlarge) diff --git a/docs/chapter_array_and_linkedlist/array.md b/docs/chapter_array_and_linkedlist/array.md index df8bc35..51a359e 100644 --- a/docs/chapter_array_and_linkedlist/array.md +++ b/docs/chapter_array_and_linkedlist/array.md @@ -134,6 +134,8 @@ elementAddr = firtstElementAddr + elementLength * elementIndex ```python title="array.py" """ 扩展数组长度 """ + # 请注意,Python 的 list 是动态数组,可以直接扩展 + # 为了方便学习,本函数将 list 看作是长度不可变的数组 def extend(nums, enlarge): # 初始化一个扩展长度后的数组 res = [0] * (len(nums) + enlarge)