Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void llmrg(struct llist *dest, struct llist *src1, struct llist *src2) {
- struct llnode
- *node1 = src1->front,
- *node2 = src2->front,
- *current = NULL;
- while( (node1!=NULL) || (node2!=NULL) ) {
- struct llnode *next = NULL;
- if( (node1!=NULL) && ( node1->item <= node2.item ) {
- next=node1;
- node1=node1->next;
- }else{
- next=node2;
- node2=node2->next;
- next->next = NULL;
- }
- if(current!=NULL) {
- current->next = next;
- }
- current = next;
- current->next = NULL;
- if(dest->front == NULL) {
- dest->front = current;
- }
- }
- }
Add Comment
Please, Sign In to add comment