下载此beplayapp体育下载

编写链接队列的基本操作函数.doc


beplayapp体育下载分类:bepaly下载苹果 | 页数:约9页 举报非法beplayapp体育下载有奖
下载提示
  • 1.该资料是网友上传的,本站提供全文预览,预览什么样,下载就什么样。
  • 2.下载该beplayapp体育下载所得收入归上传者、原创者。
  • 3.下载的beplayapp体育下载,不会出现我们的网址水印。
1 / 9 下载此beplayapp体育下载
beplayapp体育下载列表 beplayapp体育下载介绍
该【编写链接队列的基本操作函数 】是由【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转载请标明出处.

相关beplayapp体育下载 更多>>
非法内容举报中心
beplayapp体育下载信息
  • 页数9
  • 收藏数0收藏
  • 顶次数0
  • 上传人gorynich
  • 文件大小21 KB
  • 时间2024-01-23