Skip to content

Commit d764a62

Browse files
authored
Merge branch 'main' into LilithHafner-patch-1
2 parents ab7106b + c52d8a8 commit d764a62

File tree

11 files changed

+605
-227
lines changed

11 files changed

+605
-227
lines changed

.github/dependabot.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
2+
version: 2
3+
updates:
4+
- package-ecosystem: "github-actions"
5+
directory: "/" # Location of package manifests
6+
schedule:
7+
interval: "weekly"

.github/workflows/CI.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@ jobs:
2727
- os: macOS-latest
2828
arch: x86
2929
steps:
30-
- uses: actions/checkout@v2
31-
- uses: julia-actions/setup-julia@v1
30+
- uses: actions/checkout@v4
31+
- uses: julia-actions/setup-julia@v2
3232
with:
3333
version: ${{ matrix.version }}
3434
arch: ${{ matrix.arch }}
35-
- uses: actions/cache@v1
35+
- uses: actions/cache@v4
3636
env:
3737
cache-name: cache-artifacts
3838
with:
@@ -45,6 +45,6 @@ jobs:
4545
- uses: julia-actions/julia-buildpkg@v1
4646
- uses: julia-actions/julia-runtest@v1
4747
- uses: julia-actions/julia-processcoverage@v1
48-
- uses: codecov/codecov-action@v1
48+
- uses: codecov/codecov-action@v3
4949
with:
5050
file: lcov.info

.github/workflows/Invalidations.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@ jobs:
1616
if: github.base_ref == github.event.repository.default_branch
1717
runs-on: ubuntu-latest
1818
steps:
19-
- uses: julia-actions/setup-julia@v1
19+
- uses: julia-actions/setup-julia@v2
2020
with:
2121
version: '1'
22-
- uses: actions/checkout@v3
22+
- uses: actions/checkout@v4
2323
- uses: julia-actions/julia-buildpkg@v1
2424
- uses: julia-actions/julia-invalidations@v1
2525
id: invs_pr
2626

27-
- uses: actions/checkout@v3
27+
- uses: actions/checkout@v4
2828
with:
2929
ref: ${{ github.event.repository.default_branch }}
3030
- uses: julia-actions/julia-buildpkg@v1

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Manifest.toml

Project.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
name = "SortingAlgorithms"
22
uuid = "a2af1166-a08f-5f64-846c-94a0d3cef48c"
3-
version = "1.0.1"
3+
version = "1.2.1"
44

55
[deps]
66
DataStructures = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8"
77

88
[compat]
9-
julia = "1"
109
DataStructures = "0.9, 0.10, 0.11, 0.12, 0.13, 0.14, 0.15, 0.16, 0.17, 0.18"
11-
StatsBase = "0.33"
10+
julia = "1"
1211

1312
[extras]
13+
Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595"
1414
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
1515
StatsBase = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91"
1616
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
1717

1818
[targets]
19-
test = ["Random", "StatsBase", "Test"]
19+
test = ["Aqua", "Random", "StatsBase", "Test"]

README.md

Lines changed: 70 additions & 106 deletions
Original file line numberDiff line numberDiff line change
@@ -1,126 +1,90 @@
11
# Sorting Algorithms
22

3-
[![Build status](https://github.com/JuliaLang/SortingAlgorithms.jl/workflows/CI/badge.svg)](https://github.com/JuliaLang/SortingAlgorithms.jl/actions?query=workflow%3ACI+branch%3Amaster)
3+
[![Build status](https://github.com/JuliaLang/SortingAlgorithms.jl/workflows/CI/badge.svg)](https://github.com/JuliaLang/SortingAlgorithms.jl/actions?query=workflow%3ACI+branch%3Amaster)
44
[![Coverage Status](https://coveralls.io/repos/JuliaLang/SortingAlgorithms.jl/badge.svg)](https://coveralls.io/r/JuliaLang/SortingAlgorithms.jl)
5+
[![deps](https://juliahub.com/docs/SortingAlgorithms/deps.svg)](https://juliahub.com/ui/Packages/SortingAlgorithms/6dCmw?t=2)
56

6-
The `SortingAlgorithms` package provides three sorting algorithms that can be used with Julia's [standard sorting API](https://docs.julialang.org/en/v1/base/sort/):
7+
The `SortingAlgorithms` package provides four sorting algorithms that can be used with Julia's [standard sorting API](https://docs.julialang.org/en/v1/base/sort/):
78

89
- [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.
910
- [TimSort] – a stable, general purpose, hybrid, O(n log n) comparison sort that adapts to different common patterns of partially ordered input data.
10-
- [RadixSort] – a stable, special case, O(n) non-comparison sort that works by sorting data with fixed size, one digit at a time.
11+
- [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.
12+
- [PagedMergeSort] – a stable, general purpose, O(n log n) time and O(sqrt n) space comparison sort.
1113

12-
[HeapSort]: http://en.wikipedia.org/wiki/Heapsort
13-
[TimSort]: http://en.wikipedia.org/wiki/Timsort
14-
[RadixSort]: http://en.wikipedia.org/wiki/Radix_sort
14+
[HeapSort]: https://en.wikipedia.org/wiki/Heapsort
15+
[TimSort]: https://en.wikipedia.org/wiki/Timsort
16+
[CombSort]: https://en.wikipedia.org/wiki/Comb_sort
17+
[PagedMergeSort]: https://link.springer.com/chapter/10.1007/BFb0016253
1518

1619
## Usage
1720

1821
```jl
19-
julia> using SortingAlgorithms
22+
julia> using SortingAlgorithms
2023

21-
julia> words = map(chomp,[readlines(open("/usr/share/dict/words"))...])
22-
235886-element Array{ASCIIString,1}:
23-
"A"
24-
"a"
25-
"aa"
26-
"aal"
27-
"aalii"
28-
29-
"zythem"
30-
"Zythia"
31-
"zythum"
32-
"Zyzomys"
33-
"Zyzzogeton"
24+
julia> words = map(chomp,[readlines(open("/usr/share/dict/words"))...])
25+
235886-element Array{ASCIIString,1}:
26+
"A"
27+
"a"
28+
"aa"
29+
30+
"zythum"
31+
"Zyzomys"
32+
"Zyzzogeton"
3433

35-
julia> sort!(words, alg=TimSort)
36-
235886-element Array{ASCIIString,1}:
37-
"A"
38-
"Aani"
39-
"Aaron"
40-
"Aaronic"
41-
"Aaronical"
42-
43-
"zymotize"
44-
"zymotoxic"
45-
"zymurgy"
46-
"zythem"
47-
"zythum"
34+
julia> sort!(words, alg=TimSort)
35+
235886-element Array{ASCIIString,1}:
36+
"A"
37+
"Aani"
38+
"Aaron"
39+
40+
"zymurgy"
41+
"zythem"
42+
"zythum"
4843

49-
julia> sort!(words, alg=TimSort, by=length)
50-
235886-element Array{ASCIIString,1}:
51-
"A"
52-
"B"
53-
"C"
54-
"D"
55-
"E"
56-
57-
"formaldehydesulphoxylate"
58-
"pathologicopsychological"
59-
"scientificophilosophical"
60-
"tetraiodophenolphthalein"
61-
"thyroparathyroidectomize"
44+
julia> sort!(words, alg=TimSort, by=length)
45+
235886-element Array{ASCIIString,1}:
46+
"A"
47+
"B"
48+
"C"
49+
50+
"scientificophilosophical"
51+
"tetraiodophenolphthalein"
52+
"thyroparathyroidectomize"
6253

63-
julia> sort!(words, alg=HeapSort)
64-
235886-element Array{ASCIIString,1}:
65-
"A"
66-
"Aani"
67-
"Aaron"
68-
"Aaronic"
69-
"Aaronical"
70-
71-
"zymotize"
72-
"zymotoxic"
73-
"zymurgy"
74-
"zythem"
75-
"zythum"
54+
julia> sort!(words, alg=HeapSort)
55+
235886-element Array{ASCIIString,1}:
56+
"A"
57+
"Aani"
58+
"Aaron"
59+
60+
"zymurgy"
61+
"zythem"
62+
"zythum"
7663

77-
julia> sort!(words, alg=HeapSort, by=length)
78-
235886-element Array{ASCIIString,1}:
79-
"L"
80-
"p"
81-
"U"
82-
"I"
83-
"q"
84-
85-
"pathologicopsychological"
86-
"formaldehydesulphoxylate"
87-
"scientificophilosophical"
88-
"tetraiodophenolphthalein"
89-
"thyroparathyroidectomize"
64+
julia> sort!(words, alg=HeapSort, by=length)
65+
235886-element Array{ASCIIString,1}:
66+
"L"
67+
"p"
68+
"U"
69+
70+
"scientificophilosophical"
71+
"tetraiodophenolphthalein"
72+
"thyroparathyroidectomize"
9073

91-
julia> sort!(words, alg=RadixSort)
92-
ERROR: Radix sort only sorts bits types (got ASCIIString)
93-
in error at error.jl:21
94-
in sort! at /Users/stefan/.julia/SortingAlgorithms/src/SortingAlgorithms.jl:54
95-
in sort! at sort.jl:328
96-
in sort! at sort.jl:329
97-
98-
julia> floats = randn(1000)
99-
1000-element Array{Float64,1}:
100-
1.729
101-
0.907196
102-
0.461481
103-
-0.204763
104-
-0.16022
105-
106-
0.700683
107-
-0.236204
108-
-2.15634
109-
-0.316188
110-
-0.171478
111-
112-
julia> sort!(floats, alg=RadixSort)
113-
1000-element Array{Float64,1}:
114-
-2.86255
115-
-2.72041
116-
-2.58234
117-
-2.57259
118-
-2.53046
119-
120-
3.08307
121-
3.12902
122-
3.15075
123-
3.20058
124-
3.23942
74+
julia> sort!(randn(1000), alg=CombSort)
75+
1000-element Array{Float64,1}:
76+
-2.86255
77+
-2.72041
78+
-2.58234
79+
80+
3.15075
81+
3.20058
82+
3.23942
12583
```
12684

85+
## Other packages that provide sorting algorithms
86+
87+
While SortingAlgorithms.jl is the most widely used sorting package in the Julia ecosystem, other packages are available:
88+
- https://github.com/xiaodaigh/SortingLab.jl
89+
- https://github.com/JeffreySarnoff/SortingNetworks.jl
90+
- https://github.com/nlw0/ChipSort.jl

codecov.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
comment: false

docs/pagedMerge_130_130.gif

786 KB
Loading

0 commit comments

Comments
 (0)