Page 182 - DCAP201_FUNDAMENTALS_OF_DATA_STRUCTURES
P. 182
Unit 10: Queues
case 2: Notes
eq_front();
break;
case 3:
eq_back();
break;
case 4:
dq_front();
break;
case 5:
dq_back();
break;
case 6 :
exit(6);
}
}
}
create_list()
{
int I, x;
dqptr t;
p = getnode();
tp = p;
p->left = getnode();
p->info = 10;
p_right = getnode();
return;
}
dqptr getnode()
{
p = (dqptr) malloc(sizeof(struct dq));
return p;
}
dq_empty(dq q)
{
return q->head = = NULL;
}
eq_front(dq q, void *info)
{
if (dq_empty(q))
q->head = q->tail = dcons(info, NULL, NULL);
LOVELY PROFESSIONAL UNIVERSITY 175