文件名称:Post-Office
介绍说明--下载内容来自于网络,使用问题请自行百度
算法设计与分析中邮局选址问题。
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/
Post Office/answer/
Post Office/answer/post0.OUT
Post Office/answer/post1.OUT
Post Office/answer/post10.OUT
Post Office/answer/post2.OUT
Post Office/answer/post3.OUT
Post Office/answer/post4.OUT
Post Office/answer/post5.OUT
Post Office/answer/post6.OUT
Post Office/answer/post7.OUT
Post Office/answer/post8.OUT
Post Office/answer/post9.OUT
Post Office/Post Office.pdf
Post Office/test/
Post Office/test/post0.IN
Post Office/test/post1.IN
Post Office/test/post10.IN
Post Office/test/post2.IN
Post Office/test/post3.IN
Post Office/test/post4.IN
Post Office/test/post5.IN
Post Office/test/post6.IN
Post Office/test/post7.IN
Post Office/test/post8.IN
Post Office/test/post9.IN
Post Office/answer/
Post Office/answer/post0.OUT
Post Office/answer/post1.OUT
Post Office/answer/post10.OUT
Post Office/answer/post2.OUT
Post Office/answer/post3.OUT
Post Office/answer/post4.OUT
Post Office/answer/post5.OUT
Post Office/answer/post6.OUT
Post Office/answer/post7.OUT
Post Office/answer/post8.OUT
Post Office/answer/post9.OUT
Post Office/Post Office.pdf
Post Office/test/
Post Office/test/post0.IN
Post Office/test/post1.IN
Post Office/test/post10.IN
Post Office/test/post2.IN
Post Office/test/post3.IN
Post Office/test/post4.IN
Post Office/test/post5.IN
Post Office/test/post6.IN
Post Office/test/post7.IN
Post Office/test/post8.IN
Post Office/test/post9.IN
本网站为编程资源及源代码搜集、介绍的搜索网站,版权归原作者所有! 粤ICP备11031372号
1999-2046 搜珍网 All Rights Reserved.