{【保存】

include <stdio.h>

include <stdlib.h>

int flag = 0;
typedef struct{
int data;
int flag;
struct Linklist *next;
}Linklist;

//创建LC存储LA,LB的交并差(无序)
Linklist* LinkAIO(Linklist *LA,Linklist *LB)
{
Linklist LC,node;
LC = (Linklist *)malloc(sizeof(Linklist));
Linklist p = LA->next,q = LB->next;
//交集
while(p != NULL)
{
while(q!=NULL)
{
if(p->data == q->data)
{
p->flag = 1;

        }
        else
        {
            q = q->next;
        }

    }
    q = LB->next;
    p = p->next;

}
//重新回到头节点,用于下次循环
p = LA->next;
q = LB->next
while(p->next!=NULL)
{
   
  //处理LC的数据域(*****)
  
          for(;p->next!=NULL;p = p->next)
      {
          
          if(p->data == 0)
          {
              node = (Linklist *)malloc(sizeof(Linklist));
              node->data = p->data;
              node->next = LC->next ;
            LC->next  = node;
          }
          else
          {
              continue;
          }
            
      }
      
 
}

}

int main()
{

return 0;

}

上一篇:b_lc_长度为 3 的不同回文子序列(统计两个相同字符中间有多少个不同字符)


下一篇:Lc面试题1617连续数列