Êý¾Ý½á¹¹ÖªÊ¶µã×ܽá ÏÂÔر¾ÎÄ

βָÕëʼÖÕÖ¸Ïò¶ÓÁÐβָÕëµÄÏÂÒ»¸öλÖÃ

ÔÚÕ»ÂúµÄÇé¿öÏ£¬²»ÄÜ×÷½øÕ»ÔËË㣬·ñÔò²úÉú¡°ÉÏÒ硱¡£

¶ÓÁУº1.ʲôÊǶÓÁУ¿Ò²ÊÇÒ»ÖÖÌØÊâµÄÏßÐÔ±í£¨²åÈëÔÚ±íµÄÒ»¶Ë£¬É¾³ýÔÚ±íµÄÁíÒ»¶Ë£©¶ÓÁУºÏȽøÏȳö Çø±ðÓÚÏßÐÔ±í£º²åÈ롢ɾ³ýÔÚͬһ¶Ë¡£

2.¶ÓÁеIJÙ×÷£º 1.²åÈë¡£

Åбð¶ÓÁпռ䡰¿Õ¡±»ò¡°Âú¡±

a.ÁíÉèÒ»¸ö±ê־λÒÔÇø±ð¶ÓÁС°¿Õ¡±»ò¡°Âú¡±

b.ÉÙÓÃÒ»¸öÔªËؿռ䣬Լ¶¨ÒÔ¡°¶ÓÁÐÍ·Ö¸ÕëÔÚ¶ÓÁÐβָÕëµÄÏÂÒ»¸öλÖã¨Ö¸»·×´µÄÏÂһλÖã©¡±ÉÏ×÷Ϊ¶ÓÁгʡ°Âú¡±×´Ì¬µÄ±êÖ¾ ×ܽ᣺ÈôRear>Front£¬ÔªËظöÊýΪRear-Front£»ÈôRear

int Queue Insert(Q[],front,rear,x) {

if(rear>=QMAX) {

printf(\return 0;

} else { } } 2.ɾ³ý£º

ElemType Queue Delete(Q[],front,rear) {

if(rear<=front) { } else { } }

ÒÔÉÏΪ´íÎóËã·¨,rear

front=front+1; printf(\return 0; rear=rear+1; Q[rear]<=x; return 1;

ÕëÖصþ¡°¼ÙÂú¡±¡ßɾ³ý/²åÈëÒ»´ÎÎÞÊ£¬N´ÎÔòÎÞÓÃÁË¡£²åÈëÂúÁËÖ»ÄÜɾ³ý£¬rear¡¢front¾ùÔÚ⣬²åÈëΪÂú£¬É¾³ýΪ¿Õ¡à³ÉΪÁËÎÞÓöÓÁС£

ÕýÈ·µÄ¶ÓÁвåÈëÓëɾ³ýËã·¨ÈçÏ£º int Queue Insert(Q[],front,rear,x) {

if((rear+1)mod QMAX=front) { } else {

mod QMAX Q[rear]<=x; printf(\return 0;