@@ -86,7 +86,7 @@ issorted(itr;
86
86
issorted (itr, ord (lt,by,rev,order))
87
87
88
88
function partialsort! (v:: AbstractVector , k:: Union{Integer,OrdinalRange} , o:: Ordering )
89
- _sort! (v, InitialOptimizations (QuickerSort (k)), o, (;))
89
+ _sort! (v, InitialOptimizations (ScratchQuickSort (k)), o, (;))
90
90
maybeview (v, k)
91
91
end
92
92
@@ -950,12 +950,12 @@ end
950
950
951
951
952
952
"""
953
- QuickerSort (next::Algorithm=SMALL_ALGORITHM) <: Algorithm
954
- QuickerSort (lo::Union{Integer, Missing}, hi::Union{Integer, Missing}=lo, next::Algorithm=SMALL_ALGORITHM) <: Algorithm
953
+ ScratchQuickSort (next::Algorithm=SMALL_ALGORITHM) <: Algorithm
954
+ ScratchQuickSort (lo::Union{Integer, Missing}, hi::Union{Integer, Missing}=lo, next::Algorithm=SMALL_ALGORITHM) <: Algorithm
955
955
956
- Use the `QuickerSort ` algorithm with the `next` algorithm as a base case.
956
+ Use the `ScratchQuickSort ` algorithm with the `next` algorithm as a base case.
957
957
958
- `QuickerSort ` is like `QuickSort`, but utilizes scratch space to operate faster and allow
958
+ `ScratchQuickSort ` is like `QuickSort`, but utilizes scratch space to operate faster and allow
959
959
for the possibility of maintaining stability.
960
960
961
961
If `lo` and `hi` are provided, finds and sorts the elements in the range `lo:hi`, reordering
@@ -973,15 +973,15 @@ Characteristics:
973
973
* *quadratic worst case runtime* in pathological cases
974
974
(vanishingly rare for non-malicious input)
975
975
"""
976
- struct QuickerSort {L<: Union{Integer,Missing} , H<: Union{Integer,Missing} , T<: Algorithm } <: Algorithm
976
+ struct ScratchQuickSort {L<: Union{Integer,Missing} , H<: Union{Integer,Missing} , T<: Algorithm } <: Algorithm
977
977
lo:: L
978
978
hi:: H
979
979
next:: T
980
980
end
981
- QuickerSort (next:: Algorithm = SMALL_ALGORITHM) = QuickerSort (missing , missing , next)
982
- QuickerSort (lo:: Union{Integer, Missing} , hi:: Union{Integer, Missing} ) = QuickerSort (lo, hi, SMALL_ALGORITHM)
983
- QuickerSort (lo:: Union{Integer, Missing} , next:: Algorithm = SMALL_ALGORITHM) = QuickerSort (lo, lo, next)
984
- QuickerSort (r:: OrdinalRange , next:: Algorithm = SMALL_ALGORITHM) = QuickerSort (first (r), last (r), next)
981
+ ScratchQuickSort (next:: Algorithm = SMALL_ALGORITHM) = ScratchQuickSort (missing , missing , next)
982
+ ScratchQuickSort (lo:: Union{Integer, Missing} , hi:: Union{Integer, Missing} ) = ScratchQuickSort (lo, hi, SMALL_ALGORITHM)
983
+ ScratchQuickSort (lo:: Union{Integer, Missing} , next:: Algorithm = SMALL_ALGORITHM) = ScratchQuickSort (lo, lo, next)
984
+ ScratchQuickSort (r:: OrdinalRange , next:: Algorithm = SMALL_ALGORITHM) = ScratchQuickSort (first (r), last (r), next)
985
985
986
986
# select a pivot, partition v[lo:hi] according
987
987
# to the pivot, and store the result in t[lo:hi].
@@ -1020,7 +1020,7 @@ function partition!(t::AbstractVector, lo::Integer, hi::Integer, offset::Integer
1020
1020
pivot_index
1021
1021
end
1022
1022
1023
- function _sort! (v:: AbstractVector , a:: QuickerSort , o:: Ordering , kw;
1023
+ function _sort! (v:: AbstractVector , a:: ScratchQuickSort , o:: Ordering , kw;
1024
1024
t= nothing , offset= nothing , swap= false , rev= false )
1025
1025
@getkw lo hi scratch
1026
1026
@@ -1038,7 +1038,7 @@ function _sort!(v::AbstractVector, a::QuickerSort, o::Ordering, kw;
1038
1038
end
1039
1039
swap = ! swap
1040
1040
1041
- # For QuickerSort (), a.lo === a.hi === missing, so the first two branches get skipped
1041
+ # For ScratchQuickSort (), a.lo === a.hi === missing, so the first two branches get skipped
1042
1042
if ! ismissing (a. lo) && j <= a. lo # Skip sorting the lower part
1043
1043
swap && copyto! (v, lo, t, lo+ offset, j- lo)
1044
1044
rev && reverse! (v, lo, j- 1 )
@@ -1236,7 +1236,7 @@ the initial optimizations because they can change the input vector's type and or
1236
1236
make them `UIntMappable`.
1237
1237
1238
1238
If the input is not [`UIntMappable`](@ref), then we perform a presorted check and dispatch
1239
- to [`QuickerSort `](@ref).
1239
+ to [`ScratchQuickSort `](@ref).
1240
1240
1241
1241
Otherwise, we dispatch to [`InsertionSort`](@ref) for inputs with `length <= 40` and then
1242
1242
perform a presorted check ([`CheckSorted`](@ref)).
@@ -1268,7 +1268,7 @@ Consequently, we apply [`RadixSort`](@ref) for any reasonably long inputs that r
1268
1268
stage.
1269
1269
1270
1270
Finally, if the input has length less than 80, we dispatch to [`InsertionSort`](@ref) and
1271
- otherwise we dispatch to [`QuickerSort `](@ref).
1271
+ otherwise we dispatch to [`ScratchQuickSort `](@ref).
1272
1272
"""
1273
1273
const DEFAULT_STABLE = InitialOptimizations (
1274
1274
IsUIntMappable (
@@ -1278,9 +1278,9 @@ const DEFAULT_STABLE = InitialOptimizations(
1278
1278
ConsiderCountingSort (
1279
1279
ConsiderRadixSort (
1280
1280
Small {80} (
1281
- QuickerSort ())))))),
1281
+ ScratchQuickSort ())))))),
1282
1282
StableCheckSorted (
1283
- QuickerSort ())))
1283
+ ScratchQuickSort ())))
1284
1284
"""
1285
1285
DEFAULT_UNSTABLE
1286
1286
@@ -1485,7 +1485,7 @@ function partialsortperm!(ix::AbstractVector{<:Integer}, v::AbstractVector,
1485
1485
end
1486
1486
1487
1487
# do partial quicksort
1488
- _sort! (ix, InitialOptimizations (QuickerSort (k)), Perm (ord (lt, by, rev, order), v), (;))
1488
+ _sort! (ix, InitialOptimizations (ScratchQuickSort (k)), Perm (ord (lt, by, rev, order), v), (;))
1489
1489
1490
1490
maybeview (ix, k)
1491
1491
end
0 commit comments