void bubble_sort_recursive(int *a,int j,int n)
{
if(n==1)
{
return;
}
if(j==n-1)
{
bubble_sort_recursive(a,0,n-1);
}
if(a[j]>a[j+1])
{
swap(a[j],a[j+1]);
}
bubble_sort_recursive(a,j+1,n);
return;
}
int main()
{
int a[]={3,2,4,1,56,23};
int n=sizeof(a)/sizeof(int);
bubble_sort_recursive(a,0,n);
for(int j=0;j<n;j++)
{
cout<<a[j]<<" ";
}
return 0;
}
this code is running perfectly but not giving output.please tell me my mistakes.