int main()
{
	struct ListNode* head;
	int arr[] = {2,1,4,3,6,5,7,8};
	struct ListNode *t = array_to_link(arr, 8);
	print_list(t);
	struct ListNode *v = oddEvenList(t);
	print_list(v);
	return 0;
}
Exemple #2
0
int main(int argc, char **argv)
{
    struct ListNode n6 = {6, NULL},
                    n5 = {5, &n6},
                    n4 = {4, &n5},
                    n3 = {3, &n4},
                    n2 = {2, &n3},
                    n1 = {1, &n2},
                    n0 = {1, &n4},
                    *res;
    int is_res;
    print(&n0);
    print(&n1);
    res = oddEvenList(&n1);
    print(res);
    return 0;
}
Exemple #3
0
int main(){

    addToFront(6);
    addToFront(5);
    addToFront(4);
    addToFront(3);
    addToFront(2);
    addToFront(1);

    printLL(gHead);

    gHead = oddEvenList(gHead);

    printLL(gHead);

    return 0;
}