Is there any method to remove the duplicate elements in an array in place in C/C++ in O(n)? Suppose elements are a[5]={1,2,2,3,4} then resulting array should c
a[5]={1,2,2,3,4}
The example you have given is a sorted array. It is possible only in that case (given your constant space constraint)