GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - JuliaCollections/SortingAlgorithms.jl: extra sorting algorithms extending Julia's sorting API

BranchesTags
Open more actions menu

Latest commit

 

History

98 Commits
98 Commits

Folders and files

NameName
Last commit message
Last commit date
.github
.github
 
 
docs
docs
 
 
src
src
 
 
test
test
 
 
.gitignore
.gitignore
 
 
LICENSE.md
LICENSE.md
 
 
Project.toml
Project.toml
 
 
README.md
README.md
 
 
codecov.yml
codecov.yml
 
 

Repository files navigation

Sorting Algorithms

Build status Coverage Status deps

The SortingAlgorithms package provides four sorting algorithms that can be used with Julia's standard sorting API:

  • HeapSort – an unstable, general purpose, in-place, O(n log n) comparison sort that works by heapifying an array and repeatedly taking the maximal element from the heap.
  • TimSort – a stable, general purpose, hybrid, O(n log n) comparison sort that adapts to different common patterns of partially ordered input data.
  • CombSort – an unstable, general purpose, in-place, O(n log n) comparison sort with O(n^2) pathological cases that can attain good efficiency through SIMD instructions and instruction level parallelism on modern hardware.
  • PagedMergeSort – a stable, general purpose, O(n log n) time and O(sqrt n) space comparison sort.

Usage

julia> using SortingAlgorithms

julia> words = map(chomp,[readlines(open("/usr/share/dict/words"))...])
235886-element Array{ASCIIString,1}:
 "A"
 "a"
 "aa"
 ⋮
 "zythum"
 "Zyzomys"
 "Zyzzogeton"

julia> sort!(words, alg=TimSort)
235886-element Array{ASCIIString,1}:
 "A"
 "Aani"
 "Aaron"
 ⋮
 "zymurgy"
 "zythem"
 "zythum"

julia> sort!(words, alg=TimSort, by=length)
235886-element Array{ASCIIString,1}:
 "A"
 "B"
 "C"
 ⋮
 "scientificophilosophical"
 "tetraiodophenolphthalein"
 "thyroparathyroidectomize"

julia> sort!(words, alg=HeapSort)
235886-element Array{ASCIIString,1}:
 "A"
 "Aani"
 "Aaron"
 ⋮
 "zymurgy"
 "zythem"
 "zythum"

julia> sort!(words, alg=HeapSort, by=length)
235886-element Array{ASCIIString,1}:
 "L"
 "p"
 "U"
 ⋮
 "scientificophilosophical"
 "tetraiodophenolphthalein"
 "thyroparathyroidectomize"

julia> sort!(randn(1000), alg=CombSort)
1000-element Array{Float64,1}:
 -2.86255
 -2.72041
 -2.58234
  ⋮
  3.15075
  3.20058
  3.23942

Other packages that provide sorting algorithms

While SortingAlgorithms.jl is the most widely used sorting package in the Julia ecosystem, other packages are available:

  • https://github.com/xiaodaigh/SortingLab.jl
  • https://github.com/JeffreySarnoff/SortingNetworks.jl
  • https://github.com/nlw0/ChipSort.jl

About

extra sorting algorithms extending Julia's sorting API

Resources

Readme
License
Activity
Custom properties

Stars

55 stars

Watchers

14 watching

Forks

27 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.