堆排序:
java.util.ArraysHeapSort { (String[] args) { [] list = {}System..println(+ Arrays.(list))(list)System..println(+ Arrays.(list))} ([] list) { (i = list./ i >= i--) { (listilist.- )} (i = list.-i>i--){ temp = list[]list[] = list[i]list[i] = temp(listi)} } ([] listparentlength) { temp = list[parent]child = parent * + (child < length) { (child + < length && list[child + ] < list[child]){ child ++ } (list[child] > list[parent]){ } list[parent] = list[child]parent = childchild = * parent +} list[parent] = temp} }