/// <summary> /// 协同排序 /// </summary> /// <param name="sod"></param> /// <param name="dis"></param> /// <returns></returns> private List<int> oids(List<int> sod, List<double> dis) { for (int tmpi = 0; tmpi < dis.Count; tmpi++) { //找到最小的id int lid = tmpi; for (int tmpj = tmpi + 1; tmpj < dis.Count; tmpj++) { if (dis[lid] > dis[tmpj]) { lid = tmpj; } } //互换最小的与当前 double ti = dis[lid]; int tname = sod[lid]; dis[lid] = dis[tmpi]; dis[tmpi] = ti; sod[lid] = sod[tmpi]; sod[tmpi] = tname; } return sod; }
时间: 2024-10-27 12:56:48