该【编写链接队列的基本操作函数 】是由【gorynich】上传分享,beplayapp体育下载一共【9】页,该beplayapp体育下载可以免费在线阅读,需要了解更多关于【编写链接队列的基本操作函数 】的内容,可以使用beplayapp体育下载的站内搜索功能,选择自己适合的beplayapp体育下载,以下文字是截取该文章内的部分文字,如需要获得完整电子版,请下载此beplayapp体育下载到您的设备,方便您编辑和打印。编写链接队列的基本操作函数(1)(LinkQueue*Q,QElemTypee),队空DeQueue(LinkQueue*Q,QElemTypee)(LinkQueue*Q)(2)调用上述函数实现下列操作,(3)(SqQueue*Q,QElemTypee),队空DeQueue(SqQueue*Q,QElemTypee)(SqQueue*Q)(4)调用上述函数实现下列操作,:#include<>#include<>typedefstructnode{intdata;structnode*next;};typedefstruct{structnode*front;structnode*rear;}LinkQueue;InitQueue(LinkQueue*Q){Q->front=(structnode*)malloc(sizeof(structnode));Q->rear=Q->front;Q->front->next=NULL;}EnQueue(LinkQueue*Q,inte){structnode*p;p=(structnode*)malloc(sizeof(structnode));p->data=e;p->next=NULL;Q->rear->next=p;Q->rear=p;}DeQueue(LinkQueue*Q,inte){structnode*p;if(Q->front==Q->rear)return0;else{p=Q->front->next;Q->front->next=p->next;if(p->next=NULL)Q->rear=Q->front;return(p->data);free(p);}}OutputQueue(LinkQueue*Q){structnode*p;p=Q->front->next;while(p!=NULL){printf("%d",p->data);p=p->next;}}GetFront(LinkQueue*Q){structnode*p;p=Q->front->next;printf("%d",p->data);}voidmain(){LinkQueues;inti,max,e,item;InitQueue(&s);printf("putamax:");scanf("%d",&max);printf("shuruyuansu");for(i=0;i
#include<>typedefstruct{int*base;intfront;intrear;}SqQueue;InitQueue(SqQueue*Q){Q->base=(int*)malloc(MAXQSIZE*sizeof(int));if(!Q->base)exit(1);Q->front=Q->rear=0;EnQueue(SqQueue*Q,inte){Q->base[Q->rear]=e;Q->rear=(Q->rear+1)%MAXQSIZE;}DeQueue(SqQueue*Q,int*e){if(Q->front==Q->rear)return0;e=Q->base[Q->front];Q->front=(Q->front+1)%MAXQSIZE;}GetFront(SqQueue*Q){if(Q->front==Q->rear)return0;elseprintf("%d",Q->base[(Q->front)%MAXQSIZE]);}OutputQueue(SqQueue*Q){inti;i=Q->front;if(!(Q->front==Q->rear)){while((i%MAXQSIZE)!=Q->rear){printf("%d",Q->base[i%MAXQSIZE]);i++;}}}voidmain(){SqQueue*s;inti,max,e,item;InitQueue(&s);printf("putamax:");scanf("%d",&max);printf("shuruyuansu:");for(i=0;i
编写链接队列的基本操作函数 来自beplayapp体育下载www.apt-nc.com转载请标明出处.