题目描述:
有两串链表表示为A和B,删除链表A中的结点,满足删除条件的结点是该结点与链表B中某结点的值相同。
代码如下:
# include <iostream>
using namespace std;
typedef struct List
{
int value;
struct List * next;
} pList;
int deleteNode(pList *, pList*);
void createList(pList *, int[], int);
void printList(pList *);
int deleteNode(pList **pListHead, pList *pDeleteListHead)
{
if (*pListHead == NULL || pDeleteListHead == NULL)
return 0;
int cnt = 0;
pList *pNode = *pListHead;
pList *pDeleteNode = pDeleteListHead;
pList *pNewHead = NULL;
while (pNode != NULL)
{
pList *qNode = pNode -> next;
boo