1.

   int rmvDup(int arr[],int arrLen)
   {
       int i,j;
       for (i =1,j=0; i< arrLen;i++)
       {
           if (arr[j] != arr[i])
           {
               arr[j+1] = arr[i];
               j = j+1;
           }
       }
       return j+1;
   }

   This function assumes that the input is sorted.
   O(n) time complexity without any additional space
   2. this is sol........i got from sumwhere...hope it help sumone...may b u
   peaople cum with new ....for unsorted...sort in nlogn..then remove in n


On Sun, Oct 2, 2011 at 9:48 PM, rahul sharma <[email protected]>wrote:

> 1. remove duplicates from array when it is sorted......o(n)tym and o(1)
> space..
> 2. remove duplicates from array when it is not sorted......o(n)tym and o(1)
> space..
>
> i can tget these from archives...if anybody earlier asked then plz post me
> the link of thta....if not then rovide me with sol of these 2
> question.....thnx in advance
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to