Sort the letters of string in alphabetical order: Difference between revisions
Sort the letters of string in alphabetical order (view source)
Revision as of 05:42, 26 July 2021
, 2 years ago→{{header|Julia}}
m (CalmoSoft moved page Sort the letters of string in alphabitical order to Sort the letters of string in alphabetical order) |
|||
Line 169:
<lang julia>function mergesort!(array)
middle = div(length(array), 2)
middle == 0 && return array
mergesort!(@view array[begin:middle])
Line 175:
tmp = Vector{eltype(array)}(undef, length(array))
merge!(array[begin:middle], array[middle+1:end], tmp)
return array .= tmp
end
|