From cd6a6b6d2864646dbaceb2c9ca49648585c30adc Mon Sep 17 00:00:00 2001 From: Ashwek Swamy <39827514+ashwek@users.noreply.github.com> Date: Sun, 10 Feb 2019 11:21:31 +0530 Subject: [PATCH] Delete duplicate file --- Sorting/OddEven_Sort.cpp | 68 ---------------------------------------- 1 file changed, 68 deletions(-) delete mode 100644 Sorting/OddEven_Sort.cpp diff --git a/Sorting/OddEven_Sort.cpp b/Sorting/OddEven_Sort.cpp deleted file mode 100644 index 790d391a5..000000000 --- a/Sorting/OddEven_Sort.cpp +++ /dev/null @@ -1,68 +0,0 @@ -/* C++ implementation Odd Even Sort */ -#include -using namespace std; - -void switchElmts(int arr[], int i, int j) -{ - int tmp = arr[i]; - arr[i] = arr[j]; - arr[j] = tmp; -} - -void oddEven(int arr[], int size) -{ - bool sorted = false; - while(!sorted) - { - sorted = true; - for(int i = 1; i < size-1; i += 2)//Odd - { - if(arr[i] > arr[i+1]) - { - switchElmts(arr,i,i+1); - sorted = false; - } - } - - for(int i = 0; i < size-1; i += 2)//Even - { - if(arr[i] > arr[i+1]) - { - switchElmts(arr,i,i+1); - sorted = false; - } - } - } -} - -void show(int A[], int size) -{ - int i; - for (i = 0; i < size; i++) - cout<>size; - - int arr[size]; - - cout<<"\nEnter the unsorted elements : "; - - for (int i = 0; i < size; ++i) - { - cout<<"\n"; - cin>>arr[i]; - } - - oddEven(arr, size); - - cout<<"Sorted array\n"; - show(arr, size); - return 0; -}