Re:Is this the simplest (and most surprising) sorting algori...
by sunnyque on Tuesday October 05, 2021 @10:35AM
(#28760052)
for almost two decades I thought this is a bubble sorting algorithm
[ Parent
| on HN ]
Re:Is this the simplest (and most surprising) sorting algori...
by Jtsummers on Tuesday October 05, 2021 @10:55AM
(#28760347)
Bubble 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.