写正确函数须要注意的地方:链表的合并排序

Node* mergeSort(Node* head, int length) { if(length==0) return NULL; if(length==1) { head->pNext=NULL;//必定要赋值为NULL,不然可能出现死循环。 return head; } int halflength=length/2; Node* halfp=head; fo
相关文章
相关标签/搜索