文章
126
粉丝
35
获赞
0
访问
24.8k
(1)
(2)
NODE* middleNode(NODE* head) {
NODE* slow = head;
NODE* fast = head;
while (fast->next != NULL && fast->next->next != NULL) {
slow = slow->next;
fast = fast->next->next;
}
return slow;
}
NODE* reverseList(NODE* head) {
NODE* prev = NULL;
NODE* curr = head;
while (curr != NULL) {
NODE* nextTemp = curr->next;
curr->next = prev;
prev = curr;
curr = nextTemp;
}
return prev;
}
void mergeList(NODE* l1, NODE* l2) {
NODE* l1_tmp;
NODE* l2_tmp;
while (l1 != NULL && l2 != NULL) {
l1_tmp = l1->next;
l2_tmp = l2...
登录后发布评论
暂无评论,来抢沙发