using System; using System.Text; namespace HuaTong.General.Utility { /// <summary> /// 自定义排序类 /// </summary> public class Sorter { /// <summary> /// 交换元素位置 /// </summary> public static void Swap<T>(ref T[] arr, int i, int j)…
# -*- coding: utf-8 -*- import random def bubble_sort(seq): n = len(seq) for i in range(n-1): print(seq) for j in range(n-1-i): if seq[j] > seq[j+1]: seq[j], seq[j+1] = seq[j+1], seq[j] print(seq) def test_bubble_sort(): seq = list(range(10)) random.…