Hi, my first post.
I canīt understand the insert (or enqueue) operation in this algorithm where we work with Doubly Linked List with sort (ordering) during insert operation.
Could you help me please? I am putting comments in the lines where I have this difficulty to understand
Here is the code:
Code:typedef struct list { int info; struct list *next; struct list *prev; } list; list *LHead, *LTail;Code:int value_info() { int info; printf("\nValue = "); scanf("%d",&info); return info; }Code:void insert() { list *p, *a, *q; int new; new = value_info(); q = (list *)calloc(1,sizeof(list)); q->info = new; p = LHead; //what does this mean??? while (p->info < new) //what does this mean??? p = p->next; //what does this mean??? a = p->prev; //what does this mean??? a->next = q; //what does this mean??? p->prev = q; //what does this mean??? q->next = p; //what does this mean??? q->prev = a; //what does this mean??? printf("Value %d inserted on list!",new); }



LinkBack URL
About LinkBacks



