bubbelsort
Bubbelsort, commonly known in English as bubble sort, is a simple comparison-based sorting algorithm. The idea is to repeatedly pass through a list, compare adjacent values, and swap them if they are out of order. After each pass, the largest unsorted element moves to its final position, much like bubbles rising to the surface, hence the name.
The typical implementation uses two nested loops: the outer loop tracks the number of passes, and the
Time and space complexity: In the worst and average case, bubbelsort transverses the list in O(n^2) time.
Variants and practical notes: An optimized version reduces unnecessary comparisons on sorted lists. A bidirectional variant,