Return to Snippet

Revision: 36430
at November 22, 2010 01:19 by antstefek


Initial Code
struct qu {
elementtype value;
struct qu *next;
};
struct que {
struct qu *front, *rear;
};
typedef struct que queue;
typedef struct qu *element;
elementtype FrontQ(queue *Q){
if (Q->front==Q->rear)
cout << "Prazan red.";
else
return ((Q->front)->next)->value;
}
void EnqueueQ(elementtype X, queue *Q){
element E = new qu;
E->value = X;
E->next = NULL;
(Q->rear)->next = E;
Q->rear = E;
}
void DequeueQ(queue *Q){
element E;
if (Q->front==Q->rear)
cout << "Prazan red.";
else{
E = Q->front;
Q->front = (Q->front)->next;
delete E;
}}
bool IsEmptyQ(queue *Q){
if (Q->front==Q->rear)
return true;
else
return false;
}
void InitQ(queue *Q){
element E = new qu;
Q->front = E;
Q->rear = E;
E->next = NULL;
}

Initial URL

                                

Initial Description
Implementacija reda pomoću pokazivaća

Initial Title
Zadatak 3 Antonio Å tefek

Initial Tags

                                

Initial Language
C++