void insert(int urgency, LList *pq, customer cust) {
//Initialize a node.
LLNode *node;
node=(LLNode *)malloc(sizeof(LLNode));
//Initialize a customer pointer and a "save" pointer
LLNode *custp = pq->beg;
LLNode *custpsave;
//Put the data in the node.
node->data=cust;
//Assign the 'linkage'
//If there is no beginning, make this the beginning.
if(!(pq->beg)) {
pq->beg=node;
}
//Is the first ones urgency less than the call we just input, make the new one the input and move the other one
else if (pq->beg->data.urgency<(cust.urgency)) {
node->next=pq->beg;
pq->beg=node;
} else {
//Traverse the linked list until we find one with a lower urgency than the one we have now
custpsave=pq->beg;
custp=custpsave->next;
while((custp != NULL) && (cust.urgency <= custp->data.urgency)) {
custpsave = custp;
custp = custp->next;
}
node->next=custpsave->next;
custpsave->next=node;
}
}