Bubblesort recursion function

Thank you for this great explaination. I am really enjoying these videos and finally understanding how recursion works.

however, I wanted to ask whether this approach for recursion would work or no? I am getting the right answer so I was wondering if this is fine or not?

void bubblesort2(int *arr, int n, int j)

{
if (n == 1)

{
    return;
}
if (arr[j] > arr[j + 1])

{
    swap(arr[j], arr[j + 1]);
}

bubblesort2(arr, n - 1, j + 1);

}

sorry for this doubt, I got my answer myself! :slight_smile: