Untitled
def quick_sort(arr, low, high): if low < high: pivot = arr[high] i = low - 1 for j in range(low, high): if arr[j] <= pivot: i += 1 arr[i], arr[j] = arr[j], arr[i] arr[i+1], arr[high] = arr[high], arr[i+1] quick_sort(arr, low, i) quick_sort(arr, i+2, high) return arr arr = [15, 5, 28, 10, 7, 20, 12] print(quick_sort(arr, 0, len(arr)-1)) Apakah di kode ini terdapat partition, coba jelaskan secara detail
Leave a Comment