Monday, 5 March 2012

Deleting Duplicates From 1D array

int * DeleteDuplicateItems(int array[])
{
   int  n=array.length;
for(int i=0;i<n-1;i++)
{
     for(int j=i+1 ; j<n ; j++ )
      {
         if(array[i] = = a[ j])
        {
           n=n-1;
           for(int k=j ; k<n ; k++ )
            {
               a[k]=a[k+1];
                j=j+1
            }
          }
       }
}

No comments:

Post a Comment