void bubble_sort (int a[], unsigned s)
{
/* sort array a of s elements */
int i, n;
n=s;
do
{
for (i=1; i<s; ++i)
{
if (a[i]<a[i-1])
{
/* swap */
int t = a[i];
a[i] = a[i-1];
a[i-1]=t;
n=i;
}
}
s=n;
} while (s!=0);
}
You would sort the given elements of an array by a bubble sort or heap sort code!!
types of sorting in c language are: insertion sort selection sort bubble sort merge sort two way merge sort heap sort quick sort
Bubble sort is also known as sinking sort.
Yes, bubble sort is a stable sorting algorithm.
Selection sort is more efficient for small datasets compared to bubble sort.
eccount c
One code is BUBBLE
ramesh
Bubble sort is an "in place" algorithm. Other than a temporary "switch" variable, no extra space is required.
Binary sort and bubble sort are two.
no
bubbles