mirror of
https://github.com/CodePanda66/CSPostgraduate-408.git
synced 2023-05-21 21:49:33 +08:00
🎨 format file
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
//
|
||||
// Created by kim yang on 2020/8/3.
|
||||
// Copyright (c) Kim Yang All rights reserved.
|
||||
//
|
||||
|
||||
//链式队列(带头节点版本)
|
||||
@@ -7,6 +8,8 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
/**定义模块**/
|
||||
|
||||
typedef struct LinkNode {
|
||||
int data;
|
||||
struct LinkNode *next;
|
||||
@@ -15,7 +18,9 @@ typedef struct LinkNode {
|
||||
typedef struct {
|
||||
LinkNode *front, *rear;
|
||||
} LinkQueue;
|
||||
/**定义模块**/
|
||||
|
||||
/**实现模块**/
|
||||
void InitQueue(LinkQueue &Q) {
|
||||
Q.front = Q.rear = NULL;
|
||||
//不带头点,初始化时,front 、rear 指向NULL
|
||||
@@ -68,7 +73,9 @@ bool GetHead(LinkQueue Q, int &x) {
|
||||
bool QueueEmpty(LinkQueue Q) {
|
||||
return Q.front == Q.rear ? true : false;
|
||||
}
|
||||
/**实现模块**/
|
||||
|
||||
/**测试模块**/
|
||||
void PrintQueue(LinkQueue Q) {
|
||||
printf("开始打印队列\n");
|
||||
int i = 0;
|
||||
@@ -119,6 +126,7 @@ void TestLinkQueue() {
|
||||
|
||||
printf("测试结束!\n");
|
||||
}
|
||||
/**测试模块**/
|
||||
|
||||
int main() {
|
||||
TestLinkQueue();
|
||||
|
||||
Reference in New Issue
Block a user