Skip to content

Instantly share code, notes, and snippets.

@YK-Unit
Created September 8, 2023 22:39
Show Gist options
  • Save YK-Unit/0d3fd6a835c1e7f16096e8e7533290e2 to your computer and use it in GitHub Desktop.
Save YK-Unit/0d3fd6a835c1e7f16096e8e7533290e2 to your computer and use it in GitHub Desktop.
代码的简介
这是一个基本的冒泡排序算法的 Python 实现:
def bubble_sort(lst):
n = len(lst)
for i in range(n):
for j in range(n-i-1):
if lst[j] > lst[j+1]:
lst[j], lst[j+1] = lst[j+1], lst[j]
return lst
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment