Doubt about bubble sort. Will this code work for recursive solution of Bubble Sort?

#include
using namespace std;

void bubble_sort(int arr[], int n, auto x, auto start)
{
if(n == 1)
return;
if(arr > x)
{
arr = start;
bubble_sort(arr, n - 1, x, start);
}
else
{
if(arr[0] > arr[1])
swap(arr[0], arr[1]);
bubble_sort(arr + 1, n, x, start);
}
}

int main()
{
int n;
cin >> n;
int arr[n];
auto x = arr + n;
auto start = arr;
for(int i=0; i<n; i++)
cin >> arr[i];
bubble_sort(arr, n, x, start);
for(int i=0; i<n; i++)
cout << arr[i] << " ";

return 0;

}

@Souvik_Ghosh hey your logic is not correct:If we take a closer look at Bubble Sort algorithm, we can notice that in first pass, we move largest element to end (Assuming sorting in increasing order). In second pass, we move second largest element to second last position and so on.

Recursion Idea.

Base Case: If array size is 1, return.
Do One Pass of normal Bubble Sort. This pass fixes last element of current subarray.
Recur for all elements except last of current subarray.
void bubbleSort(int arr[], int n)
{
// Base case
if (n == 1)
return;

// One pass of bubble sort. After 
// this pass, the largest element 
// is moved (or bubbled) to end. 
for (int i=0; i<n-1; i++) 
    if (arr[i] > arr[i+1]) 
        swap(arr[i], arr[i+1]); 

// Largest element is fixed, 
// recur for remaining array 
bubbleSort(arr, n-1); 

}

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.