@@ -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
@@ -953,12 +953,12 @@ end
953
953
954
954
955
955
"""
956
- QuickerSort (next::Algorithm=SMALL_ALGORITHM) <: Algorithm
957
- QuickerSort (lo::Union{Integer, Missing}, hi::Union{Integer, Missing}=lo, next::Algorithm=SMALL_ALGORITHM) <: Algorithm
956
+ ScratchQuickSort (next::Algorithm=SMALL_ALGORITHM) <: Algorithm
957
+ ScratchQuickSort (lo::Union{Integer, Missing}, hi::Union{Integer, Missing}=lo, next::Algorithm=SMALL_ALGORITHM) <: Algorithm
958
958
959
- Use the `QuickerSort ` algorithm with the `next` algorithm as a base case.
959
+ Use the `ScratchQuickSort ` algorithm with the `next` algorithm as a base case.
960
960
961
- `QuickerSort ` is like `QuickSort`, but utilizes scratch space to operate faster and allow
961
+ `ScratchQuickSort ` is like `QuickSort`, but utilizes scratch space to operate faster and allow
962
962
for the possibility of maintaining stability.
963
963
964
964
If `lo` and `hi` are provided, finds and sorts the elements in the range `lo:hi`, reordering
@@ -976,15 +976,15 @@ Characteristics:
976
976
* *quadratic worst case runtime* in pathological cases
977
977
(vanishingly rare for non-malicious input)
978
978
"""
979
- struct QuickerSort {L<: Union{Integer,Missing} , H<: Union{Integer,Missing} , T<: Algorithm } <: Algorithm
979
+ struct ScratchQuickSort {L<: Union{Integer,Missing} , H<: Union{Integer,Missing} , T<: Algorithm } <: Algorithm
980
980
lo:: L
981
981
hi:: H
982
982
next:: T
983
983
end
984
- QuickerSort (next:: Algorithm = SMALL_ALGORITHM) = QuickerSort (missing , missing , next)
985
- QuickerSort (lo:: Union{Integer, Missing} , hi:: Union{Integer, Missing} ) = QuickerSort (lo, hi, SMALL_ALGORITHM)
986
- QuickerSort (lo:: Union{Integer, Missing} , next:: Algorithm = SMALL_ALGORITHM) = QuickerSort (lo, lo, next)
987
- QuickerSort (r:: OrdinalRange , next:: Algorithm = SMALL_ALGORITHM) = QuickerSort (first (r), last (r), next)
984
+ ScratchQuickSort (next:: Algorithm = SMALL_ALGORITHM) = ScratchQuickSort (missing , missing , next)
985
+ ScratchQuickSort (lo:: Union{Integer, Missing} , hi:: Union{Integer, Missing} ) = ScratchQuickSort (lo, hi, SMALL_ALGORITHM)
986
+ ScratchQuickSort (lo:: Union{Integer, Missing} , next:: Algorithm = SMALL_ALGORITHM) = ScratchQuickSort (lo, lo, next)
987
+ ScratchQuickSort (r:: OrdinalRange , next:: Algorithm = SMALL_ALGORITHM) = ScratchQuickSort (first (r), last (r), next)
988
988
989
989
# select a pivot, partition v[lo:hi] according
990
990
# to the pivot, and store the result in t[lo:hi].
@@ -1023,7 +1023,7 @@ function partition!(t::AbstractVector, lo::Integer, hi::Integer, offset::Integer
1023
1023
pivot_index
1024
1024
end
1025
1025
1026
- function _sort! (v:: AbstractVector , a:: QuickerSort , o:: Ordering , kw;
1026
+ function _sort! (v:: AbstractVector , a:: ScratchQuickSort , o:: Ordering , kw;
1027
1027
t= nothing , offset= nothing , swap= false , rev= false )
1028
1028
@getkw lo hi scratch
1029
1029
@@ -1041,7 +1041,7 @@ function _sort!(v::AbstractVector, a::QuickerSort, o::Ordering, kw;
1041
1041
end
1042
1042
swap = ! swap
1043
1043
1044
- # For QuickerSort (), a.lo === a.hi === missing, so the first two branches get skipped
1044
+ # For ScratchQuickSort (), a.lo === a.hi === missing, so the first two branches get skipped
1045
1045
if ! ismissing (a. lo) && j <= a. lo # Skip sorting the lower part
1046
1046
swap && copyto! (v, lo, t, lo+ offset, j- lo)
1047
1047
rev && reverse! (v, lo, j- 1 )
@@ -1239,7 +1239,7 @@ the initial optimizations because they can change the input vector's type and or
1239
1239
make them `UIntMappable`.
1240
1240
1241
1241
If the input is not [`UIntMappable`](@ref), then we perform a presorted check and dispatch
1242
- to [`QuickerSort `](@ref).
1242
+ to [`ScratchQuickSort `](@ref).
1243
1243
1244
1244
Otherwise, we dispatch to [`InsertionSort`](@ref) for inputs with `length <= 40` and then
1245
1245
perform a presorted check ([`CheckSorted`](@ref)).
@@ -1271,7 +1271,7 @@ Consequently, we apply [`RadixSort`](@ref) for any reasonably long inputs that r
1271
1271
stage.
1272
1272
1273
1273
Finally, if the input has length less than 80, we dispatch to [`InsertionSort`](@ref) and
1274
- otherwise we dispatch to [`QuickerSort `](@ref).
1274
+ otherwise we dispatch to [`ScratchQuickSort `](@ref).
1275
1275
"""
1276
1276
const DEFAULT_STABLE = InitialOptimizations (
1277
1277
IsUIntMappable (
@@ -1281,9 +1281,9 @@ const DEFAULT_STABLE = InitialOptimizations(
1281
1281
ConsiderCountingSort (
1282
1282
ConsiderRadixSort (
1283
1283
Small {80} (
1284
- QuickerSort ())))))),
1284
+ ScratchQuickSort ())))))),
1285
1285
StableCheckSorted (
1286
- QuickerSort ())))
1286
+ ScratchQuickSort ())))
1287
1287
"""
1288
1288
DEFAULT_UNSTABLE
1289
1289
@@ -1497,7 +1497,7 @@ function partialsortperm!(ix::AbstractVector{<:Integer}, v::AbstractVector,
1497
1497
end
1498
1498
1499
1499
# do partial quicksort
1500
- _sort! (ix, InitialOptimizations (QuickerSort (k)), Perm (ord (lt, by, rev, order), v), (;))
1500
+ _sort! (ix, InitialOptimizations (ScratchQuickSort (k)), Perm (ord (lt, by, rev, order), v), (;))
1501
1501
1502
1502
maybeview (ix, k)
1503
1503
end
0 commit comments