Advertisement
Guest User

Untitled

a guest
Feb 28th, 2020
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.74 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. int a[10000]= {0};
  4. struct node
  5. {
  6.     int data;
  7.     struct node *next;
  8. };
  9. int main()
  10. {
  11.     struct node *prev,*head,*p;
  12.     int n,i;
  13.     scanf("%d",&n);
  14.     head=NULL;
  15.     for(i=0; i<n; i++)
  16.     {
  17.         p=(struct node*)malloc(sizeof(struct node));
  18.         scanf("%d",&p->data);
  19.         p->next=NULL;
  20.         if(head==NULL)
  21.         {
  22.             head=p;
  23.         }
  24.         else
  25.         {
  26.             prev->next=p;
  27.         }
  28.         prev=p;
  29.     }
  30.     struct node* ptr,temp;
  31.     ptr=head;
  32.     while(ptr!=NULL)
  33.     {
  34.         a[ptr->data]++;
  35.         if(a[ptr->data]>1){
  36.             ///delete this node
  37.         }
  38.         ptr=ptr->next;
  39.     }
  40.     ///print the link list
  41.     return 0;
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement