|
|
@ -37,8 +37,8 @@ def bubble_sort_with_flag(nums: list[int]) -> None:
|
|
|
|
if __name__ == "__main__":
|
|
|
|
if __name__ == "__main__":
|
|
|
|
nums = [4, 1, 3, 1, 5, 2]
|
|
|
|
nums = [4, 1, 3, 1, 5, 2]
|
|
|
|
bubble_sort(nums)
|
|
|
|
bubble_sort(nums)
|
|
|
|
print("排序后数组 nums =", nums)
|
|
|
|
print("冒泡排序完成后 nums =", nums)
|
|
|
|
|
|
|
|
|
|
|
|
nums1 = [4, 1, 3, 1, 5, 2]
|
|
|
|
nums1 = [4, 1, 3, 1, 5, 2]
|
|
|
|
bubble_sort_with_flag(nums1)
|
|
|
|
bubble_sort_with_flag(nums1)
|
|
|
|
print("排序后数组 nums =", nums1)
|
|
|
|
print("冒泡排序完成后 nums =", nums1)
|
|
|
|