冒泡排序算法

冒泡排序算法

class Solution(): 	def maopao(self, arr: list) -> list: 		N = len(arr) 		for i in range(N-1,0,-1): 			for j in range(i): 				temp = 0 				if arr[j] > arr[j+1]: 					temp = arr[j] 					arr[j] = arr[j+1] 					arr[j+1] = temp  		return arr  if __name__ == '__main__': 	arr = list(map(int,input().strip().split())) 	s = Solution() 	kk = s.maopao(arr) 	N = len(kk) 	for i in range(N): 		print(kk[i],end=' ')