encyclopegia.org

Gnome sort

Gnome sort (nicknamed stupid sort) is a variation of the insertion sort sorting algorithm that does not use nested loops.[src] Gnome sort was known for a long time and used without naming it explicitly.[src] It was then popularized by Iranian computer scientist Hamid Sarbazi-Azad (professor of Computer Science and Engineering at Sharif University of Technology) in 2000.[src] The sort was first called stupid sort (not to be confused with bogosort), and then later described by Dick Grune and named gnome sort.[src] Gnome sort performs at least as many comparisons as insertion sort and has the same asymptotic run time characteristics.[src] 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.[src] The average running time is O(n 2 ) but tends towards O(n) if the list is initially almost sorted.[src] Dick Grune described the sorting method with the following story:[src]

Gnome sort (nicknamed stupid sort) is a variation of the insertion sort sorting algorithm that does not use nested loops.[src] Gnome sort was known for a long time and used without naming it explicitly.[src] It was then popularized by Iranian computer scientist Hamid Sarbazi-Azad (professor of Computer Science and Engineering at Sharif University of Technology) in 2000.[src] The sort was first called stupid sort (not to be confused with bogosort), and then later described by Dick Grune and named gnome sort.[src] Gnome sort performs at least as many comparisons as insertion sort and has the same asymptotic run time characteristics.[src] 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.[src] The average running time is O(n 2 ) but tends towards O(n) if the list is initially almost sorted.[src] Dick Grune described the sorting method with the following story: pos := 1 while pos = a[pos-1]): pos := pos + 1 else: swap a[pos] and a[pos-1] pos := pos - 1 ===Example=== Given an unsorted array, a = [5, 3, 2, 4], the gnome sort takes the following steps during the while loop.[src] The current position is highlighted in bold and indicated as a value of the variable pos .[src] ==Notes== ==References== ==External links== Gnome sort[src]

18 sentences · 18 cited inline · 0 references stored

References

No reference rows published for this article.

Cite this article

MLA

"Gnome sort." encyclopegia.org, 2026, https://encyclopegia.org/wiki/gnome-sort. Accessed 28 November 2026.

Chicago

"Gnome sort." encyclopegia.org. Accessed November 28, 2026. https://encyclopegia.org/wiki/gnome-sort.

APA

encyclopegia.org. (2026). Gnome sort. Retrieved November 28, 2026, from https://encyclopegia.org/wiki/gnome-sort

Accessed November 28, 2026 · CC BY-SA 4.0 · citation page · JSON

Related articles

GNOME Panel

stub · references available

GNOME

stub · references available

GNOME Planner

stub · references available

Eye of GNOME

stub · references available

GNOME Screenshot

stub · references available

GNOME Virtual file system

stub · references available

GNOME Terminal

stub · references available

GNOME SlackBuild

stub · references available
CC BY-SA 4.0 · share-alike · https://en.wikipedia.org/w/index.php?oldid=1372560248 · 0.5 · snapshot enwiki-001372560248

Cite · JSON · Search

Related services and records

Services

  • Estate — measured countries, lanes and facts
  • Intel — live corroborated events
  • Legal — statutes, cases and citations
  • Encyclopedia — articles with inline sources
  • Space — launches, satellites and orbits
  • Search — federated search and reports
  • Pass — passport account and SSO
  • Corpora — read-only corpus origins
  • e01 — self-hosted corpora and tools
  • Careers — open roles: frontier engineers and sales partners

Text and metadata only; each target carries its own sources. Missing data is published as no-data, never estimated.