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 { ...
import Foundation extension MyTreeNodeSolution { //递归 func postOrderTraversal(_ root: TreeNode?,_ n: inout [Int]) { if root == nil { return } ...
import Foundation class ShellSortSolution { func sort(_ n: [Int]) -> [Int] { var s = n var gap = n.count/2 while gap > 0 { ...