Bubble Sort in Python
Bubble sort compares neighbours and swaps if they are out of order. Large values drift to the end like bubbles. Easy to trace on [4, 1, 3, 2]. Slow on big lists — about O(n²). Good for learning swaps. Real code uses sorted() / list.sort() (Timsort). Say that honestly.
One pass idea + complexity + “not for production size” is the full answer. Don’t implement bubble in a live project when sorted() exists.
Bubble Sort in Python — output — [1, 2, 3, 4]. Neighbours swap until sorted.
Complexity + why not used for big data.