MCPcopy Create free account
hub / github.com/142vip/408CSFamily / EnLoopQueue

Function EnLoopQueue

code/ds/LoopQueue.cpp:15–23  ·  view source on GitHub ↗

入队算法 尾插法:Q.data[Q.rear]=x;Q.rear=(Q.rear+1)%Maxsize;Q.tag=1 队空条件:Q.front== Q.rear且Q.tag==0

Source from the content-addressed store, hash-verified

13// 尾插法:Q.data[Q.rear]=x;Q.rear=(Q.rear+1)%Maxsize;Q.tag=1
14// 队空条件:Q.front== Q.rear且Q.tag==0
15int EnLoopQueue(SqQueue &Q, ElemType x){
16 if(Q.front==Q.rear&&Q.tag==1){
17 return 0;
18 }
19 Q.data[Q.rear]=x;
20 Q.rear=(Q.rear+1)%MaxSize;
21 Q.tag=1;
22 return 1;
23}
24
25
26

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected