⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 divcon.h

📁 算法实验:1 分治法在数值问题中的应用 ——最近点对问题 2 减治法在组合问题中的应用——8枚硬币问题 3 变治法在排序问题中的应用——堆排序 4 动态规划法在图问题中的应用——全源最短路径问题
💻 H
字号:
#ifndef	DIVDON_H
#define DIVDON_H

//#include "D:\VCprojects\common.h"

#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <time.h>
#include <limits.h>
#include <math.h>


#define POWER(x,y)	( (x)-(y) )*( (x)-(y) )

#define MAX_POINT 32	//max points  assume that max_point is a power of 2

typedef struct{
	int x;	//Abscissa横坐标
	int y;	//Ordinate纵坐标
}Point;
typedef struct{
	Point p[MAX_POINT];
	int num;	//the number of current points
}Points;
typedef struct{
	Point p1;
	Point p2;
	int distance;
}Dis,*Distance;

//initialize array A
void InitPoints(Points *A);

//Copy the array src[start......end-1] of the elements to array des[0....end-start]
// which from start to end
void ArrayCopy(Points *des,Points src,int start,int end);

//Sorts array A[0....n-1] by recursive mergesort
//Input:	An array A[0...n-1] of orderable elements
//Outpur:	An sorted Array A[0...n-1]
void Mergesort(Points *A,const int choice);

//Merges two sorted arrays into one sorted array
//Input:	Array B[0...p-1] and C[0..q-1] both sorted
//Output:	Sorted array A[0...p+q-1] of the elements of B and C
void Merge(Points B,Points C,Points *A,const int choice);

//Output array A[0....n-1] of the elements
void Output(Points A);

//initialize array A[0....n] with auto-generated data
void AutoPoints(Points *A);

//Find two closest points from array A[0....n-1]
//Input:	An  sorted array A[0...n-1]
//Output:	the value of two-point and the two points 
void ClosestPoints(Points A,Distance *D);

//Find the smallest distance between two-point in subset A
//return the smallest distance
Distance SmallestDis(Points A);

//
void Closest(Points B,Points C,Distance *D);

void DivStart();

#endif DIVDON_H

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -