文件名称:lab22
介绍说明--下载内容均来自于网络,请自行研究使用
首先,定义两个对象一个定义了点的x,y坐标和它的标号,另一个对象是两点之间的距离。然后用冒泡比较法对点的x,y坐标分别进行排序,编写控制台程序,输入点的个数,分为两种方法求最近点对。根据点的个数分为3个点的情形和大于3个点的情形,3个点的直接对两两点之间的距离进行比较。大于3点的用分治递归法求解,通过划定界限分8块没一点只对其他7块内的点进行比较长度最后求出最短距离。-First of all, define two object a definition of a x, y and its label, another object is the distance between two points. Then use of the comparative bubbling point x, y sorting respectively, write console application, input the number of points, divided into two kinds of methods for recently to point. According to the number of points divided into 3 point the situation and the greater than three points of the situation, the 3 point directly to the two the distance between the two comparison. More than three points with partition of the recursive method to solve, through the delimit limits points and eight pieces of other 7 didn t 1:00 only block point comparison for the most short length at last.
(系统自动生成,下载前可以参看下载内容)
下载文件列表
lab22.cpp