对于算法不明确,帮忙解释一下吧,谢谢。代码:using System;
using System.Collections.Generic;
using System.Text;namespace ConsoleApplication5
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] arr ={ 1, 5, 3, 6, 7, 8, 4, 0 };
            Console.Write("排序前:");
            foreach (int s in arr)
            {
                Console.Write(s);
            }
            Console.WriteLine();
            int tmp = 0;
            bool isok = false;
            while (!isok)
            {
                isok = true;
                for (int i = 0; i < arr.Length - 1; i++) //我不知道为什么这里要-1
                {
                    if (arr[i] > arr[i + 1])
                    {
                        tmp = arr[i];
                        arr[i] = arr[i + 1];
                        arr[i + 1] = tmp;
                        isok = false;
                    }
                }
            }
            Console.Write("排序后:");
            for (int i = 0; i < arr.Length; i++)
            {
                Console.Write(arr[i]);
            }
            Console.WriteLine();
        }    }
}