/*-------------Test Driver-----------*/
main(){
	struct node* a = BuildOneTwo();
	struct node* b = BuildOneTwoThree();
	struct node* merged = SortedMerge(a,b);
	struct node* temp = merged;
	PrintList(temp);
}
main()
{
	struct node* head=NULL;
	struct node* a=BuildOneTwoThree();
	struct node* b=BuildOneTwo();
		head=SortedMerge(a,b);
	while(head!=NULL){
		printf("%d ",head->data);
		head=head->next;
	}
}
Beispiel #3
0
void FrontBackSplitTest() {
    struct node* empty_list = BuildEmpty();
    struct node* list1 = BuildOne();
    struct node* list2 = BuildOneTwo();
    struct node* list3 = BuildOneThree();
    struct node* list4 = BuildOneThreeFour();
    struct node* front = NULL;
    struct node* back = NULL;

    printf("** test case 1 **\n");
    printf("origin list:\n");
    Print(empty_list);
    FrontBackSplit(empty_list, front, back);
    printf("After split:\n");
    Print(front);
    Print(back);

    printf("** test case 2 **\n");
    printf("origin list:\n");
    Print(list1);
    FrontBackSplit(list1, front, back);
    printf("After split:\n");
    Print(front);
    Print(back);

    printf("** test case 3 **\n");
    printf("origin list:\n");
    Print(list2);
    FrontBackSplit(list2, front, back);
    printf("After split:\n");
    Print(front);
    Print(back);

    printf("** test case 4 **\n");
    printf("origin list:\n");
    Print(list3);
    FrontBackSplit(list3, front, back);
    printf("After split:\n");
    Print(front);
    Print(back);

    printf("** test case 5 **\n");
    printf("origin list:\n");
    Print(list4);
    FrontBackSplit(list4, front, back);
    printf("After split:\n");
    Print(front);
    Print(back);
}