Guest User

Untitled

a guest
Jul 16th, 2018
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.69 KB | None | 0 0
  1. #include<iostream>
  2.  
  3. using namespace std;
  4.  
  5. nodo* G(nodo* L, int x)
  6. {
  7.   nodo* k = L;
  8.   if(k)
  9.   {
  10.     if(k->next==0)
  11.     {
  12.       if(k->info==x)
  13.       {
  14.         delete L;
  15.       }
  16.       else
  17.       {
  18.         return L;
  19.       }
  20.     }
  21.     else
  22.     {
  23.       while(k->next)
  24.       {
  25.         if(k->info==x)
  26.         {
  27.           nodo* y = k;
  28.           k = k->next;
  29.           delete y;
  30.         }
  31.         else
  32.         {
  33.           if(k->next->info==x)
  34.           {
  35.             nodo* y = k->next;
  36.             k->next = k->nxt->next;
  37.             delete y;
  38.           }
  39.           else
  40.           {
  41.             k = k->next;
  42.           }
  43.         }
  44.       }
  45.       return L;
  46.     }
  47.   }
  48. }
Add Comment
Please, Sign In to add comment