C#:冒泡排序,已经排好序的优化
摘要:第一层循环,i从 0到max-1 第二个循环,j从0到max-i-1 每次比较j与j+1的大小,如果发生位置交换,hasExchagend置true 如果第一次冒泡没发生交换,hasExchagend == false,说明已经全部是排好顺序的,直接break public static void
阅读全文
posted @ 2017-04-26 16:53
posted @ 2017-04-26 16:53
posted @ 2017-04-20 17:24
posted @ 2017-04-20 15:29
posted @ 2017-04-05 23:43
posted @ 2017-04-05 21:02