7void oddEven(vector<int> &arr,
int size) {
11 for (
int i = 1; i < size - 1; i += 2)
13 if (arr[i] > arr[i + 1]) {
14 swap(arr[i], arr[i + 1]);
19 for (
int i = 0; i < size - 1; i += 2)
21 if (arr[i] > arr[i + 1]) {
22 swap(arr[i], arr[i + 1]);
29void show(vector<int> A,
int size) {
31 for (i = 0; i < size; i++) cout << A[i] <<
"\n";
36 cout <<
"\nEnter the number of elements : ";
41 cout <<
"\nEnter the unsorted elements : \n";
43 for (
int i = 0; i < size; ++i) {
50 cout <<
"Sorted array\n";