#include <stdio.h>
#include <stdlib.h>
typedef int elemType;
/************************************************************************/
/* 以下是关于队列链接存储操作的6种算法 */
/************************************************************************/
struct sNode{
elemType data; /* 值域 */
struct sNode *next; /* 链接指针 */
};
struct queueLK{
struct sNode *front; /* 队首指针 */
struct sNode *rear; /* 队尾指针 */
};
/* 1.初始化链队 */
void initQueue(struct queueLK *hq)
{
hq->front = hq->rear = NULL; /* 把队首和队尾指针置空 */
return;
}
/* 2.向链队中插入一个元素x */
void enQueue(struct queueLK *hq, elemType x)
{
/* 得到一个由newP指针所指向的新结点 */
struct sNode *newP;
newP = malloc(sizeof(struct sNode));
if(newP == NULL){
printf("内存空间分配失败! ");
exit(
#include <stdlib.h>
typedef int elemType;
/************************************************************************/
/* 以下是关于队列链接存储操作的6种算法 */
/************************************************************************/
struct sNode{
elemType data; /* 值域 */
struct sNode *next; /* 链接指针 */
};
struct queueLK{
struct sNode *front; /* 队首指针 */
struct sNode *rear; /* 队尾指针 */
};
/* 1.初始化链队 */
void initQueue(struct queueLK *hq)
{
hq->front = hq->rear = NULL; /* 把队首和队尾指针置空 */
return;
}
/* 2.向链队中插入一个元素x */
void enQueue(struct queueLK *hq, elemType x)
{
/* 得到一个由newP指针所指向的新结点 */
struct sNode *newP;
newP = malloc(sizeof(struct sNode));
if(newP == NULL){
printf("内存空间分配失败! ");
exit(
文章整理:西部数码--专业提供域名注册、虚拟主机服务
http://www.west263.com
以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢!




