1,冒泡排序
//按照从大到小的样式排序
class func getArrForMaxAndMin(changeArr: [Int]) -> [Int]{
var arr = changeArr
if changeArr.count > 1 {
for i in 0 ..< arr.count - 1 {
for j in 0 ..< arr.count - i - 1 {
if arr[j] < arr[j+1] {
let temp = arr[j]
arr[j] = arr[j+1]
arr[j+1] = temp
}
}
}
}
return arr
}
网友评论