namespace C8_4
{
///
///用泡沫演算法對雙精準度型浮點數據進行排序
///
public class DoublebSort : BobblesSort
{
private Double[] arr = null; //需要排序的元素
///
///開始排序
///
///
public void StartSort(Double[] thearr)
{
arr = thearr;
length = arr.Length;
DoSort();
}
protected override void Swap(int index)
{
Double tp = arr[index];
arr[index] = arr[index + 1];
arr[index + 1] = tp;
}
protected override bool Order(int index)
{
if (arr[index] > arr[index + 1])
return true;
else
return false;
}
}
}
沒有留言:
張貼留言