两个有公共结点而部分重叠的单链表,拓扑形状看起来像Y 而非X
LinkList Search_1st_Common(LinkList L1 , LinkList L2){ int len1 = length(L1), len2 = length(2); LinkLsit longlist, shortlist; int dist; if(len1 > len2){ longlist = L1>next; shortlist = L2->next; dist = len1 - len2; else{ longlist = L2>next; shortlist = L1->next; dist = len2 - len1; while(dist--) longlist = longlist->next; while(longlist !=NULL){ if(longlist == shortlist) return longlist; else{ longlist = longlist->next; shortlist = shortlist->next; } }return NULL;} }