Skip to content

Commit 0682a52

Browse files
committed
Return sorted vector
1 parent 0bba11c commit 0682a52

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

Diff for: src/SortingAlgorithms.jl

+4-5
Original file line numberDiff line numberDiff line change
@@ -705,6 +705,7 @@ function unguarded_insertion_sort!(v::AbstractVector, lo::Integer, hi::Integer,
705705
end
706706
v[j] = x
707707
end
708+
v
708709
end
709710

710711
"""
@@ -947,7 +948,6 @@ function partition_right!(v::AbstractVector, lo::Integer, hi::Integer, a::Branch
947948

948949
end
949950
return pivot_position, was_already_partitioned
950-
951951
end
952952

953953
"""
@@ -1002,7 +1002,6 @@ function partition_left!(v::AbstractVector, lo::Integer, hi::Integer, o::Orderin
10021002
v[pivot_position] = pivot
10031003
end
10041004
return pivot_position
1005-
10061005
end
10071006

10081007
# midpoint was added to Base.sort in version 1.4 and later moved to Base
@@ -1066,7 +1065,7 @@ function pdqsort_loop!(v::AbstractVector, lo::Integer, hi::Integer, a::PatternDe
10661065
else
10671066
unguarded_insertion_sort!(v, lo, hi, o)
10681067
end
1069-
return
1068+
return v
10701069
end
10711070

10721071
# Choose pivot as median of 3 or pseudomedian of 9.
@@ -1099,7 +1098,7 @@ function pdqsort_loop!(v::AbstractVector, lo::Integer, hi::Integer, a::PatternDe
10991098
bad_allowed -= 1
11001099
if bad_allowed == 0
11011100
sort!(v, lo, hi, SortingAlgorithms.HeapSort, o)
1102-
return
1101+
return v
11031102
end
11041103

11051104
if l_len > PDQ_SMALL_THRESHOLD
@@ -1131,7 +1130,7 @@ function pdqsort_loop!(v::AbstractVector, lo::Integer, hi::Integer, a::PatternDe
11311130
if was_already_partitioned &&
11321131
partial_insertion_sort!(v, lo, pivot_pos, o) &&
11331132
partial_insertion_sort!(v, pivot_pos + 1, hi, o)
1134-
return
1133+
return v
11351134
end
11361135
end
11371136

0 commit comments

Comments
 (0)