两个List,第二个List根据第一个List排序

/// <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;
        }

 

posted @ 2015-01-11 21:21  DayDreamInGIS  阅读(1945)  评论(0编辑  收藏  举报