Add Dart codes to the documents. (#529)

This commit is contained in:
Yudong Jin
2023-06-02 02:40:26 +08:00
committed by GitHub
parent 041a989d33
commit 025051c81b
38 changed files with 849 additions and 96 deletions

View File

@@ -283,6 +283,12 @@
```
=== "Dart"
```dart title="deque.dart"
```
## 双向队列实现 *
双向队列的实现与队列类似,可以选择链表或数组作为底层数据结构。
@@ -390,6 +396,14 @@
[class]{LinkedListDeque}-[func]{}
```
=== "Dart"
```dart title="linkedlist_deque.dart"
[class]{ListNode}-[func]{}
[class]{LinkedListDeque}-[func]{}
```
### 基于数组的实现
与基于数组实现队列类似,我们也可以使用环形数组来实现双向队列。在队列的实现基础上,仅需增加“队首入队”和“队尾出队”的方法。
@@ -471,6 +485,12 @@
[class]{ArrayDeque}-[func]{}
```
=== "Dart"
```dart title="array_deque.dart"
[class]{ArrayDeque}-[func]{}
```
## 双向队列应用
双向队列兼具栈与队列的逻辑,**因此它可以实现这两者的所有应用场景,同时提供更高的自由度**。