冒泡排序--python
def bubbleSort(nums):
i = len(nums) - 1
while (i > 0):
last_index = 0
for j in range(i):
if nums[j] > nums[j+1]:
nums[j],nums[j+1] = nums[j+1],nums[j]
last_index = j
i = last_index
return nums

浙公網(wǎng)安備 33010602011771號(hào)