Bubble Sort

Bubble sort algorithm is a simple sorting algorithm that sorts the target data elements by comparing and swapping the adjacent items. Its average and worst case performance is \(O(n^2)\).

Input Parameters

Parameter Type Constraint Description Remarks
\(Y\) \(Y \in \mathbb R^N\) \(N \in \mathbb{N}\) None None

Output Parameters

Parameter Type Constraint Description Remarks
\(\hat{Y}\) \(\hat{Y} \in \mathbb R^N\) \(N \in \mathbb{N}\) Sorted data sequence of length \(N\) The output result is sensitive to improper values such as ‘nan’, ‘inf’, ‘null’, etc.

Single Steps using the Algorithm

References

    1. Knuth, The Art of Computer Programming, vol. 3: Sorting and Searching, 3rd Edition, Addison-Wesley, 1997.