Post AmCroTCwP7uustRwsi by gregorni@fosstodon.org
 (DIR) More posts by gregorni@fosstodon.org
 (DIR) Post #AmCroTCwP7uustRwsi by gregorni@fosstodon.org
       2024-09-20T20:38:23Z
       
       0 likes, 0 repeats
       
       Algorithm nerds, what's the name for the sorting algorithm where you loop over the array as often as the length of the array, and every iteration, you move the first item to the end of the list if it is larger than the second?#Programming #Algorithms
       
 (DIR) Post #AmCroU5X89aNcCzXyS by garhow@mastodon.social
       2024-09-20T20:49:51Z
       
       0 likes, 0 repeats
       
       @gregorni This sounds like bubble sort. https://en.wikipedia.org/wiki/Bubble_sort
       
 (DIR) Post #AmCroUtA9dHi68DBKa by gregorni@fosstodon.org
       2024-09-20T20:53:43Z
       
       0 likes, 0 repeats
       
       @garhow It's not, it's actually simpler. In Bubble Sort, you have two nested for loops, in this one, there's only one loop.
       
 (DIR) Post #AmCroVcBSFIULlH8VM by Archivist@social.linux.pizza
       2024-09-20T21:03:06Z
       
       0 likes, 0 repeats
       
       @gregorni @garhow you described 2 nested loops, seems like bubble sort to me indeed, but since you are confused, I would not be surprised if your description actually meant selection sort
       
 (DIR) Post #AmCroWVU8dX77H9Ihc by gregorni@fosstodon.org
       2024-09-20T20:54:27Z
       
       0 likes, 0 repeats
       
       @garhow I just made up the algorithm myself, but I'd be seriously surprised if the algorithm didn't exist yet, because it's so simple.