- Category:
- Console
- Tags:
-
[PDF]
- File Size:
- 165kb
- Update:
- 2013-11-28
- Downloads:
- 0 Times
- Uploaded by:
Description: 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.
To Search:
File list (Check if you may need any files):
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