Bubble sorting in Array in C Programming is one of the slowest, if not the slowest, sorts. It is for this reason that its use is very rare and this algorithm remains much criticized. But why is it so slow? We evaluate the speed of a sorting algorithm by observing its number of comparisons / exchanges and thus establish a scale that we call complexity. Bubble sorting makes a lot of comparisons / exchanges for few values to sort. It is mathematically estimated that it averages n (n-1)/ 4 operations for n values to sort.
In the worst case, the complexity of bubble sorting in Array in C Programming is also in O (n²). The worst case is, of this sort, a list sorted in the opposite direction. The best case is a sorted list. If the algorithm is confronted with this case, its complexity improves in O (n), which means that it makes only n comparisons form values to be sorted (in reality, for reasons of intervals, it is n ‘in fact only n-1).
Bubble sorting in Array in C Programming is one of the worst sorts because of its high complexity which results in too long execution time. And yet, this method of sorting continues to be used and this, surely, for its originality. But you still need to know that it is relatively sufficient for small lists on a computer, I say relatively. From twenty elements, it is already better to use another more suitable sorting. You have to choose your algorithm according to your needs.
printf("enter how many value in array\n");
printf("Enter %d value \n",n);
printf("Original List :\n");
/* bubble sort logic */
printf("\n\nSorted list :\n");