Beispiel #1
0
bool testMergeKLists() {
    int a[][4] = {
        {0, 1, 4, 7},
        {2, 3, 4, 8},
        {1, 4, 7, 9}
    };
    int n = COUNT_OF(a);
    struct ListNode **lists = malloc(sizeof(struct ListNode *) * n);
    int i;
    for (i = 0; i != n; i++) {
        lists[i] = buildLst(a[i], COUNT_OF(a[i]));
    }
    struct ListNode *r = mergeKLists(lists, n);
    showLst(r);
    return true;
}
void main(){
	struct node *list = buildLst();
	prntLst(list);
}