The last day of the holiday, busy no matter how to make a process, every day to yell that they will not programming, in fact, or a little bit.
Here is an orderly list of merged code, a quarter of a blind write, spent 10 minutes or so debugging through, the entire article only an if statement as a recursive exit condition.
#include <stdio.h> #include <stdlib.h> int a[] = {1,3,5,7,8,10,11,12,15,19,21,22,24,25,26};
int b[] = {2,4,5,6,9,16,17,18,27,30,31};
struct List {struct list *next;
int V;
};
void merge (struct list *iter, struct list *base) {struct list *last = iter;
if (!iter) {return;
ITER = iter->next;
while (ITER && (!base | | iter->v < BASE->V)) {last = iter;
ITER = iter->next;
} Last->next = base;
Merge (base, ITER);
int main (int argc, char **argv) {int i = 0, j = 0;
struct list *al = (struct list*) calloc (in sizeof (*al));
struct list *BL = (struct list*) calloc (one, sizeof (*BL));
struct list *itera;
struct list *iterb;
Create 2 lists {for (i = 0; i < i++) {Itera = &al[i]; Itera->v = A[i];
Itera->next = &al[i+1];
} itera->next = NULL;
for (i = 0; i < i++) {Iterb = &bl[i];
Iterb->v = B[i];
Iterb->next = &bl[i+1];
} iterb->next = NULL;
}//Merge 2 lists {merge (Al, BL); }//Print the result {for (; al; al=al->next) {printf ("%d \
n ", al->v); }
}
}
Originally wanted to find some meaning for this behavior, because it is too simple (simple does not mean that everyone can write right, I always make indefinite boundary judgment), I have time not to engage in TCP not to do Sdwan, do this.
Mainly is the vacation trip has been wasted, originally wanted to go out, however did not row, had stayed at home for three days.
Ah ha, can teach small ah. You can teach small how to combine two ordered lists into one. When I finish this program, search for someone else on the Internet to write the program, found that I was the simplest, I do not consider what time complexity, in short, can let a six-year-old IQ average child with the shortest time to understand this code is the fundamental purpose, so it is not flashy skills.
The Bamboo rod mans shoes Lightly wins the horse, who is afraid. A life of the rain. However, how to come to the misty rain. What is life.