Return to Snippet

Revision: 53929
at December 3, 2011 06:52 by tlapas


Initial Code
struct pacijent {
       int Xi, Yi, prioritet;
       };

struct qu {
       pacijent elem;
       qu *sljedeci;
       };

struct queue {
       qu *front, *rear;
       };

queue red;

void InitQ (queue &red) {
     qu *novi = new qu;
     novi->sljedeci = NULL;
     red.rear = novi;
     red.front = novi;
     }

void EnQueueQ (pacijent x, queue &red) {
     qu *novi = new qu;
     novi->elem = x;
     novi->sljedeci = NULL;
     (red.rear)->sljedeci = novi;
     red.rear = novi;
     }

pacijent FrontQ (queue red) {
      return ((red.front)->sljedeci)->elem;
      }

void DeQueueQ (queue &red) {
     qu *del = red.front;
     red.front = (red.front)->sljedeci;
     delete del;
     }

bool IsEmptyQ (queue red) {
     if (red.rear==red.front) return true;
     return false;
     }

Initial URL

                                

Initial Description
Implementacija reda preko pokazivača

Initial Title
header - pokazivac

Initial Tags
header

Initial Language
C++