Revision f56147de67bbf098de22f224b872d6df1fcbab88 authored by Tony Kelman on 24 April 2017, 18:38:11 UTC, committed by GitHub on 24 April 2017, 18:38:11 UTC
Fixed the algorithm for powers of a matrix.
2 parent s 8df5fbe + 2fbeba3
Raw File
bubblesort.jl
# This file is a part of Julia. License is MIT: https://julialang.org/license

import Base.Sort
struct 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
back to top