Generation

generate functionThu, 20 Apr 2023

heap sort

void HeapSort(Comparable[] a) { int n = a.Length; for(int k=n/2-1; k>=0; k--) sink(a, k, n); for(int k=n-1; k>=0; k--) { exch(a, 0, k); sink(a, 0, k-1); } }

Want to kickstart your project?Use the new AI Studio to create your code