Sort the given Array in Spiral manner starting from the center

#include using namespace std;  void centerSpiralSort(int arr[], int N){        int left = 0;    int right = N – 1;    int i = 1;      while (left < right) {                  for (i = left + 1; i arr[i]) {                                                  swap(arr[left], arr[i]);            }        }                  left++;                  for (i = right – 1; i >= left;             i–) {            if (arr[right] > arr[i]) {                                                  swap(arr[right], arr[i]);            }        }                  right–;    }              if (N % 2 == 0) {                  for (int i = 0; i < N / 2; i++) {            swap(arr[i], arr[N – 1 – i]);        }    }          for (int i = 0; i < N; i++) {        cout