文件名称:Post-Office
- 所属分类:
- 控制台(字符窗口)编程
- 资源属性:
- [PDF]
- 上传时间:
- 2013-11-28
- 文件大小:
- 165kb
- 下载次数:
- 0次
- 提 供 者:
- 相关连接:
- 无
- 下载说明:
- 别用迅雷下载,失败请重下,重下不扣分!
介绍说明--下载内容均来自于网络,请自行研究使用
算法设计与分析中邮局选址问题。
select(int[] array, int begin, int end, int middle)将n个输入元素划分成n/5个组,每组5个
元素,只可能有一个组不是5个元素。用任意一种排序算法,将每组中的元素排好序,并取出每组的中
位数,共n/5个。找出这n/5个元素的中位数。如果n/5是偶数,就找它的2个中位数中较大的一个。
以这个元素作为划分基准。在调用时,只需要将middle参数传入array.length/2就能找到整个数组中的
中位数。然后调用两次computeDistance(int[] array)方法,分别求出各中位数到各个居民点的横坐标
和纵坐标的距离,将两距离相加即为该问题的最优解,最后将结果存入输出文件中。-Algorithm design and analysis problems in the post office location. select (int [] array, int begin, int end, int middle) n input elements will be divided into n/5 groups, 5 elements in each group, there may be only one group is not five elements. With any of the sorting algorithm, the elements of each group sorted and remove the median for each group of n/5 个. Median identify these n/5 elements. If n/5 is an even number, to find the median of its two larger one. With this element as the division benchmarks. When you call, simply middle parameter passed array.length/2 can be found in the median of the entire array. Then called twice computeDistance (int [] array) method, the median distance were calculated for each individual settlements to the horizontal and vertical coordinates, the distance will be the sum of the two is the optimal solution to this problem, the final results into the output file.
select(int[] array, int begin, int end, int middle)将n个输入元素划分成n/5个组,每组5个
元素,只可能有一个组不是5个元素。用任意一种排序算法,将每组中的元素排好序,并取出每组的中
位数,共n/5个。找出这n/5个元素的中位数。如果n/5是偶数,就找它的2个中位数中较大的一个。
以这个元素作为划分基准。在调用时,只需要将middle参数传入array.length/2就能找到整个数组中的
中位数。然后调用两次computeDistance(int[] array)方法,分别求出各中位数到各个居民点的横坐标
和纵坐标的距离,将两距离相加即为该问题的最优解,最后将结果存入输出文件中。-Algorithm design and analysis problems in the post office location. select (int [] array, int begin, int end, int middle) n input elements will be divided into n/5 groups, 5 elements in each group, there may be only one group is not five elements. With any of the sorting algorithm, the elements of each group sorted and remove the median for each group of n/5 个. Median identify these n/5 elements. If n/5 is an even number, to find the median of its two larger one. With this element as the division benchmarks. When you call, simply middle parameter passed array.length/2 can be found in the median of the entire array. Then called twice computeDistance (int [] array) method, the median distance were calculated for each individual settlements to the horizontal and vertical coordinates, the distance will be the sum of the two is the optimal solution to this problem, the final results into the output file.
(系统自动生成,下载前可以参看下载内容)
下载文件列表
Post Office
...........\answer
...........\......\post0.OUT
...........\......\post1.OUT
...........\......\post10.OUT
...........\......\post2.OUT
...........\......\post3.OUT
...........\......\post4.OUT
...........\......\post5.OUT
...........\......\post6.OUT
...........\......\post7.OUT
...........\......\post8.OUT
...........\......\post9.OUT
...........\Post Office.pdf
...........\test
...........\....\post0.IN
...........\....\post1.IN
...........\....\post10.IN
...........\....\post2.IN
...........\....\post3.IN
...........\....\post4.IN
...........\....\post5.IN
...........\....\post6.IN
...........\....\post7.IN
...........\....\post8.IN
...........\....\post9.IN