桶排序-Swift
import Foundation let b:Array = [5,2,3,1,8] var a:NSMutableArray = [] for var i in 0 ..< 11 { a[i] = 0 } for var num in b { var index = NSInteger(num) if(a[index] as! NSInteger >= 0){ a[index] = a[index] as! (NSInteger) + 1; } else { a[index] = 0 } } for var i in 0 ..< a.count { if(a[i] as! NSInteger > 0){ print(i) } }