快排的parition划分
class Solution:
"""
@param nums: The integer array you should partition
@param k: An integer
@return: The index after partition
"""
def partitionArray(self, nums, k):
if len(nums)==0:return 0
# write your code here
"""思路:快排的partition"""
p=0
for i in range(len(nums)):
if nums[i]<k:
nums[i],nums[p]=nums[p],nums[i]
p+=1
return p