encyclopegia.org

Tournament sort

Tournament sort is a sorting algorithm.[src] It improves upon the naive selection sort by using a priority queue to find the next element in the sort.[src] In the naive selection sort, it takes O(n) operations to select the next element of n elements; in a tournament sort, it takes O(log n) operations (after building the initial tournament in O(n)).[src] Tournament sort is a variation of heapsort.[src]

Tournament sort is a sorting algorithm.[src] It improves upon the naive selection sort by using a priority queue to find the next element in the sort.[src] In the naive selection sort, it takes O(n) operations to select the next element of n elements; in a tournament sort, it takes O(log n) operations (after building the initial tournament in O(n)).[src] Tournament sort is a variation of heapsort.[src] import Data.Tree -- | Adapted from `TOURNAMENT-SORT!` in the Stepanov and Kershenbaum report.[src] tournamentSort :: Ord t where go [] = [] go trees = (rootLabel winner) : (go (subForest winner)) where winner = playTournament trees -- | Adapted from `TOURNAMENT!` in the Stepanov and Kershenbaum report playTournament :: Ord t playTournament trees = playTournament (playRound trees []) -- | Adapted from `TOURNAMENT-ROUND!` in the Stepanov and Kershenbaum report playRound :: Ord t playRound [tree] done = tree:done playRound (tree0:tree1:trees) done = playRound trees (winner:done) where winner = playGame tree0 tree1 -- | Adapted from `TOURNAMENT-PLAY!` in the Stepanov and Kershenbaum report playGame :: Ord t => Tree t -- ^ Input: ...[src] -> Tree t -- ^ ...[src] two trees -> Tree t -- ^ Result: `promote winner loser`, where `winner` is -- the tree with the *lesser* root of the two inputs playGame tree1 tree2 | rootLabel tree1 Tree t -- ^ The `loser` -> Tree t -- ^ Result: a tree whose root is the root of `winner` -- and whose children are: -- * `loser`, -- * all the children of `winner` promote winner loser = Node { rootLabel = rootLabel winner, subForest = loser : subForest winner} main :: IO () main = print $ tournamentSort testList where testList = [0, 1, 2, 3, 4, 5][src]

12 sentences · 12 cited inline · 0 references stored

References

No reference rows published for this article.

Cite this article

MLA

"Tournament sort." encyclopegia.org, 2026, https://encyclopegia.org/wiki/tournament-sort. Accessed 02 December 2026.

Chicago

"Tournament sort." encyclopegia.org. Accessed December 2, 2026. https://encyclopegia.org/wiki/tournament-sort.

APA

encyclopegia.org. (2026). Tournament sort. Retrieved December 2, 2026, from https://encyclopegia.org/wiki/tournament-sort

Accessed December 2, 2026 · CC BY-SA 4.0 · citation page · JSON

Related articles

The Tournament

stub · references available

1953 Four Hills Tournament

stub · references available

Competition Tournament

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

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
  • Index — every corpus, paper and record
  • Estate guide — what a public data estate is
  • Founder — Lois-Kleinner Alpasan
  • Records — DOIs and external deposits
  • Documents — one-pagers, PDFs and QR codes
  • Brand kit — logos and share images
  • Papers — plain-language briefs with citations
  • Browser — search engine, PWA and bookmarklet
  • Anticloud — the operator and its projects

As seen in Business Insider · 336 outlets · evidence DOIs · plain-language papers

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