队列的应用--舞会配对

题目:假设在周末舞会上,男士们和女士们进入舞厅时,各自排成一队。跳舞开始时,一次从男队和女队的队头上各自出一人配成舞伴。若两队初始人数不相同,则较长的那一队中未配对者等待下一轮舞曲。 #include <stdio.h> #include <stdlib.h> typedef struct queue //用链式队列 { char name; struct queue *next; }QUEUE; QUEUE *frontM=NULL,*rearM=NULL; QUEUE *frontF=NULL,*rearF=NULL; ...
数据结构 | 2015-07-30 11:42 | 阅读 1651 次 | 评论 0 条