diff --git a/RemovetheDuplicates.cpp b/RemovetheDuplicates.cpp new file mode 100644 index 0000000..4d507c1 --- /dev/null +++ b/RemovetheDuplicates.cpp @@ -0,0 +1,54 @@ +// C++ program for removing duplicates +#include +using namespace std; + +// Function to remove duplicate elements +// This function returns new size of modifi +int removeDuplicates(int arr[], int n) +{ + // Return, if array is empty + // or contains a single element + if (n==0 || n==1) + return n; + + int temp[n]; + + // Start traversing elements + int j = 0; + for (int i=0; i