Skip to content

Commit 82a9d52

Browse files
committed
Return sorted vector
1 parent a53f989 commit 82a9d52

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
@@ -710,6 +710,7 @@ function unguarded_insertion_sort!(v::AbstractVector, lo::Integer, hi::Integer,
710710
end
711711
v[j] = x
712712
end
713+
v
713714
end
714715

715716
"""
@@ -952,7 +953,6 @@ function partition_right!(v::AbstractVector, lo::Integer, hi::Integer, a::Branch
952953

953954
end
954955
return pivot_position, was_already_partitioned
955-
956956
end
957957

958958
"""
@@ -1007,7 +1007,6 @@ function partition_left!(v::AbstractVector, lo::Integer, hi::Integer, o::Orderin
10071007
v[pivot_position] = pivot
10081008
end
10091009
return pivot_position
1010-
10111010
end
10121011

10131012
# midpoint was added to Base.sort in version 1.4 and later moved to Base
@@ -1071,7 +1070,7 @@ function pdqsort_loop!(v::AbstractVector, lo::Integer, hi::Integer, a::PatternDe
10711070
else
10721071
unguarded_insertion_sort!(v, lo, hi, o)
10731072
end
1074-
return
1073+
return v
10751074
end
10761075

10771076
# Choose pivot as median of 3 or pseudomedian of 9.
@@ -1104,7 +1103,7 @@ function pdqsort_loop!(v::AbstractVector, lo::Integer, hi::Integer, a::PatternDe
11041103
bad_allowed -= 1
11051104
if bad_allowed == 0
11061105
sort!(v, lo, hi, SortingAlgorithms.HeapSort, o)
1107-
return
1106+
return v
11081107
end
11091108

11101109
if l_len > PDQ_SMALL_THRESHOLD
@@ -1136,7 +1135,7 @@ function pdqsort_loop!(v::AbstractVector, lo::Integer, hi::Integer, a::PatternDe
11361135
if was_already_partitioned &&
11371136
partial_insertion_sort!(v, lo, pivot_pos, o) &&
11381137
partial_insertion_sort!(v, pivot_pos + 1, hi, o)
1139-
return
1138+
return v
11401139
end
11411140
end
11421141

0 commit comments

Comments
 (0)