登录
首页 » 其他项目 » 本算法使用分治法求解最近点对问题。事先用O(nlogn)时间对x坐标进行排序,使得所有的点是按x坐标从小到大排好序的(x坐标相同时y坐标小的排前),然后取下标小...

本算法使用分治法求解最近点对问题。事先用O(nlogn)时间对x坐标进行排序,使得所有的点是按x坐标从小到大排好序的(x坐标相同时y坐标小的排前),然后取下标小...

于 2022-01-25 发布 文件大小:24.72 kB
0 75
下载积分: 2 下载次数: 1

代码说明:

本算法使用分治法求解最近点对问题。事先用O(nlogn)时间对x坐标进行排序,使得所有的点是按x坐标从小到大排好序的(x坐标相同时y坐标小的排前),然后取下标小于n/2属于左边的点集PL,取下标大于n/2属于右边的点集PR,即用O(1)时间就可以将规模为n的问题分解为两个规模为n/2的、同类型的子问题。分割完毕之后就可以采用分治法,分别求出PL和PR中的最近点对,最终通过递归实现。-This algorithm uses divide and conquer to solve the problem closest point. Prior to use O (nlogn) time to sort the x coordinate so that all points are based on x coordinates from small to large sorted (x coordinates with the same y coordinates of the small, the top), and then remove the standard is less than n/2 the set of points belonging to the left PL, remove the standard is greater than n/2 set of points belonging to the right of PR, that is to use O (1) time can be the problem size n divided into two size n/2, the same type The sub-problems. Segmentation can be used after completion of sub-rule method, respectively, find the PL and PR in the last points and eventually through the recursion.

下载说明:请别用迅雷下载,失败请重下,重下不扣分!

发表评论

0 个回复

  • 696524资源总数
  • 103886会员总数
  • 81今日下载