17 ms·
for almost two decades I thought this is a bubble sorting algorithm
by sunnyque 5y ago
for almost two decades I thought this is a bubble sorting algorithm
- Jtsummers 5y agoBubble sort only swaps adjacent pairs (thus "bubble", visualized the values "bubble up" to their correct spot) and is often abbreviated so that the inner loop runs on shorter segments (because the smallest or largest value, depending on how you write it, has been placed, no need to check that section again). this algorithm will swap non-adjacent pairs, making it more like insertion sort.