您的位置:首页 > 理论基础 > 数据结构算法

java数据结构和算法------选择排序

2015-06-08 11:55 357 查看
package iYou.neugle.sort;

public class Select_sort {
public static void SelectSort(double[] array) {
for (int i = 0; i < array.length - 1; i++) {
int tempIndex = i;

for (int j = i + 1; j < array.length; j++) {
if (array[tempIndex] > array[j])
tempIndex = j;
}

double tempData = array[tempIndex];
array[tempIndex] = array[i];
array[i] = tempData;
}
}
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: