Gnome sort
Sorting algorithm
Gnome sort (nicknamed stupid sort) is a variation of the insertion sort sorting algorithm that does not use nested loops. Gnome sort was known for a long time and used without naming it explicitly.
Nº Q936797 ★
Common · Knowledge
Gnome sort
Sorting algorithm
Gnome sort (nicknamed stupid sort) is a variation of the insertion sort sorting algorithm that does not use nested loops. Gnome sort was known for a long time and used without naming it explicitly.
From Wikipedia
Gnome sort (nicknamed stupid sort) is a variation of the insertion sort sorting algorithm that does not use nested loops. Gnome sort was known for a long time and used without naming it explicitly. It was then popularized by Iranian computer scientist Hamid Sarbazi-Azad (professor of Computer Science and Engineering at Sharif University of Technology) in 2000. The sort was first called stupid sort (not to be confused with bogosort), and then later described by Dick Grune and named gnome sort. Gnome sort performs at least as many comparisons as insertion sort and has the same asymptotic run time characteristics. Gnome sort works by building a sorted list one element at a time, getting each item to the proper place in a series of swaps. The average running time is O(n2) but tends towards O(n) if the list is initially almost sorted. Dick Grune described the sorting method with the following story: Gnome Sort is based on the technique used by the standard Dutch Garden Gnome (Du.: tuinkabouter). Here is how a garden gnome sorts a line of flower pots. Basically, he looks at the flower pot next to him and the previous one; if they are in the right order he steps one pot forward, otherwise, he swaps them and steps one pot backward. Boundary conditions: if there is no previous pot, he steps forwards; if there is no pot next to him, he is done.
Text: Wikipédia, CC BY-SA 4.0. · Image: Suaudeau (CC BY-SA 4.0) ·
Related cards
-
Bogosort
Highly ineffective sorting algorithm that successively generates permutations of its input until it finds one that is sorted
Nº Q762850 ★★★
Not listed
-
Quicksort
Divide and conquer sorting algorithm
Nº Q486598 ★★★★
Not listed
-
Stooge sort
An inefficient recursive sorting algorithm
Nº Q1754846 ★
Not listed
-
T
TPK algorithm
Program to compare computer programming languages
Nº Q7831057 ★★
Not listed
-
K
Kaprekar's routine
Iterative algorithm
Nº Q18413622 ★★★★
Not listed
-
Binary GCD algorithm
Algorithm that computes the greatest common divisor of two integers using only arithmetic shifts, comparisons, and subtraction
Nº Q622328 ★
Not listed