#include <iostream>
#include <cstdlib>
#include <time.h>
#define L 20
using namespace std;
void bubbleSortPAR(int arr[], int n)
{
if (n == 1)
return;
/*for (int i=0; i<n-1; i++){
if (arr[i] < arr[(i+1)])
swap(arr[i], arr[(i+1)]);
}*/
for (int i=0; i<(n-1); i++){
if (arr[i*2] < arr[(i+1)*2])
swap(arr[i*2], arr[(i+1)*2]);
}
bubbleSortPAR(arr, (n-1));
}
void bubbleSortIMPAR(int arr[], int n)
{
if (n == 1)
return;
for (int i=0; i<n-1; i=i+1){
if (arr[2*i+1] > arr[2*(i+1)+1])
swap(arr[2*i+1], arr[2*(i+1)+1]);
}
bubbleSortIMPAR(arr, n-1);
}
void printArray(int arr[], int n)
{
for (int i=0; i < n; i++)
cout << arr[i] << endl;
}
int main()
{
srand(time(NULL));
int A[L];
cout<<"Notas: ";
for(int j=0; j<L; j++){
A[j] = 1+rand()%20;
cout<<A[j]<<" ";
}
cout<<endl;
bubbleSortPAR(A, L/2);
bubbleSortIMPAR(A, L/2);
cout<<"Notas: ";
for(int j=0; j<L; j++){
cout<<A[j]<<" ";
}
return 0;
}