a[]={2,2,3,3,3,4,4,5,6,6,7}
size of array = n
if not sorted than sort
for(i=1;i<n-1;i++) //check for elements with index 1 to n-2
{
if(a[i]!=a[i-1] && a[i]!=a[i+1])
print(a[i]);
}
//now check for index 0 and n-1
if(a[0]!=a[1])
print(a[0]);
if(a[n-1]!=a[n-2])
print(a[n-1]);
On Sat, Jul 9, 2011 at 12:06 AM, Nitish Garg <[email protected]>wrote:
> Well your method can solve this problem when the range of the array
> elements is given.
> Try considering 2*10^9 as one of the element of the array, how big your
> temp array be?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/algogeeks/-/_WnHSu1uPRYJ.
>
> 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.
>
--
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.