/ Published in: C++
Expand |
Embed | Plain Text
struct tred{ ulaz polje[10000]; int celo,kraj; }; int AddOne(int i) { return ((i+1)%10000); } void InitQ(tred *Q){ Q = new tred; Q->celo = 0; Q->kraj = 99999; } ulaz FrontQ(tred *Q){ return Q->polje[Q->celo]; } void EnQueueQ(ulaz x, tred *Q){ Q->kraj=AddOne(Q->kraj); Q->polje[Q->kraj] = x; } void DeQueueQ(tred *Q){ Q->celo=AddOne(Q->celo); } bool IsEmptyQ(tred *Q){ if(AddOne(Q->kraj)==Q->celo) return true; else return false; }
You need to login to post a comment.
