Add time complexity in stack, queue, deque. Update heap.

This commit is contained in:
Yudong Jin
2023-01-09 02:17:40 +08:00
parent ecabb4077b
commit 6b3c87399b
8 changed files with 296 additions and 79 deletions

View File

@@ -20,13 +20,13 @@ comments: true
<div class="center-table" markdown>
| 方法 | 描述 |
| --------- | ---------------------------- |
| offer() | 元素入队,即将元素添加至队尾 |
| poll() | 队首元素出队 |
| front() | 访问队首元素 |
| size() | 获取队列的长度 |
| isEmpty() | 判断队列是否为空 |
| 方法 | 描述 | 时间复杂度 |
| --------- | ---------------------------- | ---------- |
| offer() | 元素入队,即将元素添加至队尾 | $O(1)$ |
| poll() | 队首元素出队 | $O(1)$ |
| front() | 访问队首元素 | $O(1)$ |
| size() | 获取队列的长度 | $O(1)$ |
| isEmpty() | 判断队列是否为空 | $O(1)$ |
</div>
@@ -231,7 +231,7 @@ comments: true
=== "Swift"
```swift title="queue.swift"
```
## 队列实现
@@ -621,7 +621,7 @@ comments: true
=== "Swift"
```swift title="linkedlist_queue.swift"
```
### 基于数组的实现
@@ -1030,7 +1030,7 @@ comments: true
=== "Swift"
```swift title="array_queue.swift"
```
## 队列典型应用