计算两个递增序列的差集


struct LinkNode { int data; LinkNode* next; }; LinkNode* minus_LinkList(LinkNode* A, LinkNode* B) { LinkNode* finalA = A; LinkNode* tempA = A->next; LinkNode* tempB = B->next; while (tempA && tempB) { if (tempB->data == tempA->data//相等则删除该结点 { tempA=tempA->next; A->next = tempA; } else if (tempB->data < tempA->data) { tempB = tempB->next; B = B->next; } else { tempA = tempA->next; A = A->next; } } return finalA; }
原文地址:https://www.cnblogs.com/zyqx/p/9382861.html