标签:io ar for art 问题 on c ef python
def Partition(arr): sa=[] sb=[] index=random.randint(0,len(arr)-1) p=arr[index] for i in arr: sa.append(i) if i>p else sb.append(i) return (sa,sb) def TopK(arr,k): if k<=0: return [] if len(arr)<=k: return arr (sa,sb)=Partition(arr) return TopK(sa,k)+TopK(sb,k-len(sa))
标签:io ar for art 问题 on c ef python
原文地址:http://blog.csdn.net/u012333003/article/details/39159995