From 1b29b658bf643fc081f14d7d2bcd89597430f810 Mon Sep 17 00:00:00 2001 From: krahets Date: Mon, 29 Apr 2024 15:19:01 +0800 Subject: [PATCH] build --- docs/chapter_stack_and_queue/deque.md | 24 +++++++++---------- .../array_representation_of_tree.md | 2 +- en/docs/chapter_stack_and_queue/deque.md | 24 +++++++++---------- .../array_representation_of_tree.md | 2 +- zh-Hant/docs/chapter_stack_and_queue/deque.md | 24 +++++++++---------- .../array_representation_of_tree.md | 2 +- 6 files changed, 39 insertions(+), 39 deletions(-) diff --git a/docs/chapter_stack_and_queue/deque.md b/docs/chapter_stack_and_queue/deque.md index 0f801075d..60cd0256b 100644 --- a/docs/chapter_stack_and_queue/deque.md +++ b/docs/chapter_stack_and_queue/deque.md @@ -37,28 +37,28 @@ comments: true from collections import deque # 初始化双向队列 - deque: deque[int] = deque() + deq: deque[int] = deque() # 元素入队 - deque.append(2) # 添加至队尾 - deque.append(5) - deque.append(4) - deque.appendleft(3) # 添加至队首 - deque.appendleft(1) + deq.append(2) # 添加至队尾 + deq.append(5) + deq.append(4) + deq.appendleft(3) # 添加至队首 + deq.appendleft(1) # 访问元素 - front: int = deque[0] # 队首元素 - rear: int = deque[-1] # 队尾元素 + front: int = deq[0] # 队首元素 + rear: int = deq[-1] # 队尾元素 # 元素出队 - pop_front: int = deque.popleft() # 队首元素出队 - pop_rear: int = deque.pop() # 队尾元素出队 + pop_front: int = deq.popleft() # 队首元素出队 + pop_rear: int = deq.pop() # 队尾元素出队 # 获取双向队列的长度 - size: int = len(deque) + size: int = len(deq) # 判断双向队列是否为空 - is_empty: bool = len(deque) == 0 + is_empty: bool = len(deq) == 0 ``` === "C++" diff --git a/docs/chapter_tree/array_representation_of_tree.md b/docs/chapter_tree/array_representation_of_tree.md index 6e3943c66..7c953a9cf 100644 --- a/docs/chapter_tree/array_representation_of_tree.md +++ b/docs/chapter_tree/array_representation_of_tree.md @@ -173,7 +173,7 @@ comments: true """列表容量""" return len(self._tree) - def val(self, i: int) -> int: + def val(self, i: int) -> int | None: """获取索引为 i 节点的值""" # 若索引越界,则返回 None ,代表空位 if i < 0 or i >= self.size(): diff --git a/en/docs/chapter_stack_and_queue/deque.md b/en/docs/chapter_stack_and_queue/deque.md index 2bd1813b7..079b9a368 100644 --- a/en/docs/chapter_stack_and_queue/deque.md +++ b/en/docs/chapter_stack_and_queue/deque.md @@ -37,28 +37,28 @@ Similarly, we can directly use the double-ended queue classes implemented in pro from collections import deque # Initialize the deque - deque: deque[int] = deque() + deq: deque[int] = deque() # Enqueue elements - deque.append(2) # Add to the tail - deque.append(5) - deque.append(4) - deque.appendleft(3) # Add to the head - deque.appendleft(1) + deq.append(2) # Add to the tail + deq.append(5) + deq.append(4) + deq.appendleft(3) # Add to the head + deq.appendleft(1) # Access elements - front: int = deque[0] # The first element - rear: int = deque[-1] # The last element + front: int = deq[0] # The first element + rear: int = deq[-1] # The last element # Dequeue elements - pop_front: int = deque.popleft() # The first element dequeued - pop_rear: int = deque.pop() # The last element dequeued + pop_front: int = deq.popleft() # The first element dequeued + pop_rear: int = deq.pop() # The last element dequeued # Get the length of the deque - size: int = len(deque) + size: int = len(deq) # Check if the deque is empty - is_empty: bool = len(deque) == 0 + is_empty: bool = len(deq) == 0 ``` === "C++" diff --git a/en/docs/chapter_tree/array_representation_of_tree.md b/en/docs/chapter_tree/array_representation_of_tree.md index 4ccd7cc7f..31bd845b7 100644 --- a/en/docs/chapter_tree/array_representation_of_tree.md +++ b/en/docs/chapter_tree/array_representation_of_tree.md @@ -171,7 +171,7 @@ The following code implements a binary tree based on array representation, inclu """列表容量""" return len(self._tree) - def val(self, i: int) -> int: + def val(self, i: int) -> int | None: """获取索引为 i 节点的值""" # 若索引越界,则返回 None ,代表空位 if i < 0 or i >= self.size(): diff --git a/zh-Hant/docs/chapter_stack_and_queue/deque.md b/zh-Hant/docs/chapter_stack_and_queue/deque.md index 828c120d0..475e5180c 100644 --- a/zh-Hant/docs/chapter_stack_and_queue/deque.md +++ b/zh-Hant/docs/chapter_stack_and_queue/deque.md @@ -37,28 +37,28 @@ comments: true from collections import deque # 初始化雙向佇列 - deque: deque[int] = deque() + deq: deque[int] = deque() # 元素入列 - deque.append(2) # 新增至佇列尾 - deque.append(5) - deque.append(4) - deque.appendleft(3) # 新增至佇列首 - deque.appendleft(1) + deq.append(2) # 新增至佇列尾 + deq.append(5) + deq.append(4) + deq.appendleft(3) # 新增至佇列首 + deq.appendleft(1) # 訪問元素 - front: int = deque[0] # 佇列首元素 - rear: int = deque[-1] # 佇列尾元素 + front: int = deq[0] # 佇列首元素 + rear: int = deq[-1] # 佇列尾元素 # 元素出列 - pop_front: int = deque.popleft() # 佇列首元素出列 - pop_rear: int = deque.pop() # 佇列尾元素出列 + pop_front: int = deq.popleft() # 佇列首元素出列 + pop_rear: int = deq.pop() # 佇列尾元素出列 # 獲取雙向佇列的長度 - size: int = len(deque) + size: int = len(deq) # 判斷雙向佇列是否為空 - is_empty: bool = len(deque) == 0 + is_empty: bool = len(deq) == 0 ``` === "C++" diff --git a/zh-Hant/docs/chapter_tree/array_representation_of_tree.md b/zh-Hant/docs/chapter_tree/array_representation_of_tree.md index bd73b4be2..da2dc6368 100644 --- a/zh-Hant/docs/chapter_tree/array_representation_of_tree.md +++ b/zh-Hant/docs/chapter_tree/array_representation_of_tree.md @@ -173,7 +173,7 @@ comments: true """串列容量""" return len(self._tree) - def val(self, i: int) -> int: + def val(self, i: int) -> int | None: """獲取索引為 i 節點的值""" # 若索引越界,則返回 None ,代表空位 if i < 0 or i >= self.size():