Revision 0dd43a7483cd676e61d82cdae5e67ebe7f181eb5 authored by Amit Murthy on 15 September 2015, 04:07:16 UTC, committed by Tony Kelman on 17 September 2015, 03:27:26 UTC
(cherry picked from commit 3d6c872f74aae4b81e549d9b75aec1fc0775d5b8) ref #13134
1 parent 1af871b
bubblesort.jl
# This file is a part of Julia. License is MIT: http://julialang.org/license
import Base.Sort
immutable BubbleSortAlg <: Sort.Algorithm end
const BubbleSort = BubbleSortAlg()
function Base.sort!(v::AbstractVector, lo::Int, hi::Int, ::BubbleSortAlg, o::Sort.Ordering)
while true
clean = true
for i = lo:hi-1
if Sort.lt(o, v[i+1], v[i])
v[i+1], v[i] = v[i], v[i+1]
clean = false
end
end
clean && break
end
return v
end
Computing file changes ...