We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9860e6f commit 4ae668cCopy full SHA for 4ae668c
src/dataStructure/queue/README.md
@@ -1,24 +1,22 @@
1
# 队列结构
2
## 准备数据
3
-
4
```java
5
-class DATA{
6
-String name;
7
-int age;
8
-}
9
10
-/*
11
- * 顺序结构队列
12
- * sequential queue
13
- */
14
-class SQType{
15
- static final int QUEUELEN = 15;
16
- DATA[] data = new DATA[QUEUELEN]; // 队列顺序结构数组
17
- int head; // 队头
18
- int tail; // 队尾
19
+ class DATA{
+ String name;
+ int age;
+ }
+
+ /*
+ * 顺序结构队列
+ * sequential queue
+ */
+ class SQType{
+ static final int QUEUELEN = 15;
+ DATA[] data = new DATA[QUEUELEN]; // 队列顺序结构数组
+ int head; // 队头
+ int tail; // 队尾
20
```
21
22
在上述代码中,定义了队列结构的最大长度QUEUELEN,队列结构数据元素的类DATA及队列结构的类SQType。在类SQType中,data为数据元素,head为队头的序号,tail为队尾的序号。当head=0时表示队列为空,当tail=QUEUELEN时表示队列已满。
23
## 初始化队列结构
24
顺序初始化操作步骤如下:
0 commit comments