Hardware interview practice
Bubble sort in place
Sort a dynamic array of integers in ascending order using bubble sort.
Reviewed example
Work through one case
Input
values = [5, 1, 4, 2]Expected output
[1, 2, 4, 5]Adjacent out-of-order pairs are exchanged until a pass performs no swaps.
What to cover
Requirements
- Modify the input array in place.
- Stop early when a full pass performs no swaps.
- Handle empty and one-element arrays.
