Bubble Sort sorts the items by picking the largest currently know element and move it to the right until it either no longer is the largest or meet the end of the array.
Analysis
See 202202220937
Implementation
Note: The following algorithm sorts item in ascending order.
void BubbleSort(ElementType A[], int N) {
for (int i = 0; i < N; i++)
for (j = i + 1; j < N; j++)
if (A[j - 1] > A[j])
Swap(A[j], A[j - 1]);
}