Gnome sort was originally proposed by Iranian computer scientist Hamid Sarbazi-Azad (professor of Computer Science and Engineering at Sharif University of Technology)[1] in 2000.
The average running time is O(n2) but tends towards O(n) if the list is initially almost sorted.
[4][note 1] Dick Grune described the sorting method with the following story:[3] Gnome Sort is based on the technique used by the standard Dutch Garden Gnome (Du.
Here is how a garden gnome sorts a line of flower pots.
The current position is highlighted in bold and indicated as a value of the variable pos.