Bubble sort function-
void bubble_sort(int arr[], int n)
{
int i,j,temp;
for(i=n-1;i>=0;i--)
{
for(j=1;j<=i;j++)
{
if(arr[j-1]>arr[j])
{
temp=arr[j-1];
arr[j-1]=arr[j];
arr[j]=temp;
}
}
}
}
No comments:
Post a Comment