Step 1/0
Custom array:
Complexity
Best:O(n)
Average:O(n²)
Worst:O(n²)
Space:O(1)
Description
Repeatedly compares adjacent elements and swaps them if they are in the wrong order, causing larger elements to 'bubble up' to the end.
When to use
Primarily educational. Acceptable for very small arrays or nearly-sorted data where simplicity matters more than performance.