void create2List(List lst, List& out1, List& out2) { if (lst.pHead == NULL) // no element return; out1.pHead = lst.pHead; if (lst.pHead->next == NULL) // one element out2.pHead = NULL; else { // more than one elements out2.pHead = lst.pHead->next; int temp = 3; Node* cur = out2.pHead->next; Node* cur1 = out1.pHead; Node* cur2 = out2.pHead; while (cur != NULL) { if (temp % 2 == 0) { cur2->next = cur; cur2 = cur2->next; } else { cur1->next = cur; cur1 = cur1->next; } cur = cur->next; temp++; } cur1->next = NULL; cur2->next = NULL; } }