import Foundation class QuickSortSolution { func sort(_ n: [Int]) -> [Int] { var s = n quickSort(&s, 0, n.count - 1) return s } func quickS...
import Foundation class MergeSortSolution { func sort(_ n: [Int]) -> [Int] { var s = n sortArray(&s, 0, n.count - 1) return s } func sortAr...
import Foundation class InsertSortSolution { func sort(_ n: [Int]) -> [Int] { var nums = n for i in 0..<nums.count { var j = i while j-1&...
import Foundation class HeapSortSolution { func sort(_ n: [Int]) -> [Int] { var s = n //1.初始化堆 var i = n.count/2 - 1 while i >= 0 { ...