|
|
using System;
// 冒泡排序
// ?魅胫?橐??整? 黑桃400 方?K 300 梅花 200 ?心 100
namespace BubbleSorter
{
public class NewBubbleSorter
{
public void newSort(int[] list)
{
int[] Temparry = new int[list.Length];
int[] arryCard2 = new int[list.Length];
bool done = false;
int j = 1, i, temp;
// 冒泡算法?始
for (int Q = 1; Q < 2; Q++)
{
while ((j < list.Length) && (!done))
{
done = true;
for (i = 0; i < list.Length - j; i++)
{
if (list > list[i + 1])
{
done = false;
temp = list;
list = list[i + 1];
list[i + 1] = temp;
}
}
j++;
}
for (int w = 0; w < list.Length; w++)
{
arryCard2[w] = list[w];
Temparry[w] = list[w] % 100;
list[w] = Temparry[w];
}
j = 1;
done = false;
Array.Sort(list, arryCard2);
}
// 大小重排 21KQJ109876543
for (int t = 0; t < list.Length ; t++)
{
Temparry[t] = arryCard2[t];
}
for (int a = 0, q = 16; a < list.Length ; a++, q--)
{
arryCard2[a] = Temparry[q];
list[a] = arryCard2[a];
}
}
}
} |
|