冒泡排序算法

private int[] Bubble(int[] sortData)
        {
            afterSortData = sortData;
            int tempData;
            int remainingLength = afterSortData.Length;
            for (int i = 0; i < afterSortData.Length; i++, remainingLength--)
            {
                for (int j = 1; j < remainingLength; j++)
                {
                    if (afterSortData[j] < afterSortData[j - 1])
                    {
                        tempData = afterSortData[j];
                        afterSortData[j] = afterSortData[j - 1];
                        afterSortData[j - 1] = tempData;
                    }
                }
            }
            return afterSortData;
        }
智者乐山山如画, 仁者乐水水无涯。 从从容容一杯酒, 平平淡淡一杯茶。
原文地址:https://www.cnblogs.com/bingxueme/p/2501897.html