Skip to content

Commit 4ae668c

Browse files
committed
update
1 parent 9860e6f commit 4ae668c

File tree

1 file changed

+15
-17
lines changed

1 file changed

+15
-17
lines changed

src/dataStructure/queue/README.md

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,22 @@
11
# 队列结构
22
## 准备数据
3-
43
```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-
}
4+
class DATA{
5+
String name;
6+
int age;
7+
}
8+
9+
/*
10+
* 顺序结构队列
11+
* sequential queue
12+
*/
13+
class SQType{
14+
static final int QUEUELEN = 15;
15+
DATA[] data = new DATA[QUEUELEN]; // 队列顺序结构数组
16+
int head; // 队头
17+
int tail; // 队尾
18+
}
2019
```
21-
2220
在上述代码中,定义了队列结构的最大长度QUEUELEN,队列结构数据元素的类DATA及队列结构的类SQType。在类SQType中,data为数据元素,head为队头的序号,tail为队尾的序号。当head=0时表示队列为空,当tail=QUEUELEN时表示队列已满。
2321
## 初始化队列结构
2422
顺序初始化操作步骤如下:

0 commit comments

Comments
 (0)