Python 快速排序我需要能够打印快速排序

Python 快速排序我需要能够打印快速排序,python,Python,我有下面的快速排序代码,但我无法编写快速排序和打印功能帮助!!我已多次尝试对数组进行快速排序。如果您有任何建议,请更新评论或代码 arr = [] arr2=[] arr6=[] arr7=[] arr8=[] num_lines = 0 Loop_time=(5) inp = open ("1600.txt","r") #read line into array for line in inp.readlines(): # loop over the elemets, split b

我有下面的快速排序代码,但我无法编写快速排序和打印功能帮助!!我已多次尝试对数组进行快速排序。如果您有任何建议,请更新评论或代码

arr = []
arr2=[]
arr6=[]
arr7=[]
arr8=[]
num_lines = 0
Loop_time=(5)

inp = open ("1600.txt","r")
#read line into array
for line in inp.readlines():
    # loop over the elemets, split by whitespace
    for i in line.split():
        # convert to integer and append to the list
        arr.append(int(i))
        for i in range(Loop_time):
            for name in arr:
                arr2 = arr[0:2]
                arr6 = arr[0:2]
                arr7 = arr[0:1]
                arr8 = arr[0:1]

def partition(lo, hi,**kwargs):
    i = (lo-1)
    pivot = kwargs[hi]
    for j in range (lo,hi):
        if kwargs[j] <= pivot:
            i = i+1
            kwargs[i], kwargs[j] = kwargs[j], kwargs[i]
    kwargs[i + 1], kwargs[hi]= kwargs[hi], kwargs[i + 1]
    return (i+1),kwargs
kwargs = [arr2, arr6, arr7, arr8]

def quickSort(lo, hi,**kwargs):
    if lo < hi:
        pi=partition(kwargs, lo, hi)
        quickSort(kwargs, lo, pi - 1)
        quickSort(kwargs, pi + 1, hi)
        quickSort(arr2,arr6,arr7,arr8)

def main():    
    print(arr2)
    print(arr6)
    print(arr7)

if __name__== "__main__":
    main()
arr=[]
arr2=[]
arr6=[]
arr7=[]
arr8=[]
行数=0
循环时间=(5)
inp=open(“1600.txt”,“r”)
#将行读入数组
对于inp.readlines()中的行:
#在元素上循环,用空格分隔
对于行中的i.split():
#转换为整数并附加到列表中
arr.append(int(i))
对于范围内的i(循环时间):
对于arr中的名称:
arr2=arr[0:2]
arr6=arr[0:2]
arr7=arr[0:1]
arr8=arr[0:1]
def分区(低、高、**kwargs):
i=(lo-1)
枢轴=kwargs[高]
对于范围内的j(低、高):
如果kwargs[j]
这可以对一个数组进行排序,我需要能够对所有其他数组进行排序Arr6 Arr7和Arr8我尝试过*args,但这不起作用我更改了分区和快速排序,我得到了错误帮助
导入系统,时间
arr=[]
arr2=[]
arr6=[]
arr7=[]
arr8=[]
行数=0
循环时间=(5)
inp=open(“1600.txt”,“r”)
#将行读入数组
对于inp.readlines()中的行:
#在元素上循环,用空格分隔
对于行中的i.split():
#转换为整数并附加到列表中
arr.append(int(i))
对于arr中的名称:
arr2=arr[0:29]
arr6=arr[0:5]
arr7=arr[0:10]
arr8=arr[0:7]
def分区(arr2、lo、hi):
i=(lo-1)
枢轴=arr2[hi]
对于范围内的j(低、高):

如果arr2[j]你有什么问题。现在它只是一个带有“为什么我的代码不工作”的大代码块。寻求调试帮助的问题(“为什么这个代码不工作?”)必须包括所需的行为、特定的问题或错误,以及在问题本身中重现它所需的最短代码。没有明确问题陈述的问题对其他读者没有用处。见:
Guys this works sorting one array I need to be able to sort all the other arrays Arr6 Arr7 and Arr8 I have tried *args and this does not work either I changed both the partition and Quicksort I get errors help
import sys,time

arr = []
arr2=[]
arr6=[]
arr7=[]
arr8=[]
num_lines = 0
Loop_time=(5)



inp = open ("1600.txt","r")
#read line into array
for line in inp.readlines():
    # loop over the elemets, split by whitespace
    for i in line.split():
        # convert to integer and append to the list
        arr.append(int(i))


        for name in arr:
            arr2 = arr[0:29]
            arr6 = arr[0:5]
            arr7 = arr[0:10]
            arr8 = arr[0:7]







def partition(arr2, lo, hi):
    i = (lo-1)
    pivot = arr2[hi]
    for j in range (lo,hi):
        if arr2[j] <= pivot:
            i = i+1
            arr2[i], arr2[j] = arr2[j], arr2[i]
    arr2[i + 1], arr2[hi]= arr2[hi], arr2[i + 1]
    return (i+1)

def quickSort(arr2, lo, hi):
    if lo < hi:
        pi=partition(arr2, lo, hi)
        quickSort(arr2, lo, pi - 1)
        quickSort(arr2, pi + 1, hi)
        return arr2



def main():

    SortedList =quickSort(arr2,0,len(arr2)-1)
    print(SortedList)
if __name__== "__main__":
    main()