搜索资源列表
nearpiont
- 最接近点对问题是求二维坐标中的点对问题,该算法是为了将平面上点集S线性分割为大小大致相等的2个子集S1和S2,我们选取一垂直线l:x=m来作为分割直线。其中m为S中各点x坐标的中位数。由此将S分割为S1={p∈S|px≤m}和S2={p∈S|px>m}。从而使S1和S2分别位于直线l的左侧和右侧,且S=S1∪S2 。由于m是S中各点x坐标值的中位数,因此S1和S2中的点数大致相等。 递归地在S1和S2上解最接近点对问题,我们分别得到S1和S2中的最小距离δ1和δ2。现设δ=min(δ
acjanchan
- 2^x mod n = 1 acm竞赛题 Give a number n, find the minimum x that satisfies 2^x mod n = 1. Input One positive integer on each line, the value of n. Output If the minimum x exists, print a line with 2^x mod n = 1. Print 2^?
stringcmp
- 设A和B是长度相同的2个字符串。A和B的距离定义为相应位置字符距离之和。2个非空格字符的距离是它们的ASCII码之差的绝对值。空格与空格的距离为0;空格与其它字符的距离为一定值k。 字符串A的扩展是在A中插入若干空格字符所产生的字符串。在字符串A和B的所有长度相同的扩展中,有一对距离最小的扩展,该距离称为字符串A和B的扩展距离。 对于给定的字符串A和B,试设计一个算法,计算其扩展距离。 -Let A and B is the same length of two strings. A
MinimumSpanningTree
- 在图形中若于个边(edge)上加上一些值,此数值称为比重( weight ) 。而此图形称为比重图形(Weight Graph ) ,若weight是成本( cost )或距离( distance ) ,则称此图形为网路( Network )。根据Spanning Tree的定义,知一个图形可有许多不同spanning tree ,在network中找出一个具有最小成本( Cost )的Spanning tree ,则此Spanning tree称为最小成本生成树。-If in the grap
maandian
- 找马鞍点:1. 若在矩阵Am×n中存在一个元素A[i][j],其满足A[i][j]是第i行元素中最小值,且又是第j列元素中最大值,则称此元素为该矩阵的一个马鞍点。用二维数组存储矩阵Am×n ,设计算法求出矩阵中所有马鞍点。-Find a saddle point: 1. If in the matrix Am × n, there is a element of A [i] [j], the meet A [i] [j] is the first line element in the mini
heffuman
- 通过建立赫夫曼树,将码元如“ABC”编码成 “011001”形式,也可通过此赫夫曼树进行译码,而且编码形式为最小生成树形式,即在有权值情况下编码长度最短。-Through the establishment of Huffman trees, will be key element such as " ABC" code as " 011001" form can also be carried out through the Huffman decodi
prim
- prim求最小生成树,求最短路径,并求出权值-prim for minimum spanning tree, and the shortest path and find the right value
golden_cut_method
- 2. 黄金分割法的的核心思想是逼近,而最终结果的精确程度取决于相对精度e的大小,e越小,结果越精确,迭代次数越多,这一点从图一的程序运行结果中可以很明显的看出。 3. 程序运行过程中首先输入初始区间[0,1],然后输入迭代后最后区间的长度0.2,最后得出极小值和极小值点。 -2. Golden section method is the core idea of approximation, while the final result depends on the precise re
HuffmanCoding
- 如何在二叉树中找出权值和最小的路径,赫夫曼编码-How to find the right binary value and the minimum path, Huffman coding
2(2)
- 最小生成树之Prim算法 Prim算法用于求无向图的最小生成树 设图G =(V,E),其生成树的顶点集合为U。 ①、把v0放入U。 ②、在所有u∈U,v∈V-U的边(u,v)∈E中找一条最小权值的边,加入生成树。 ③、把②找到的边的v加入U集合。如果U集合已有n个元素,则结束,否则继续执行②。 其算法的时间复杂度为O(n^2) Prim算法实现: (1)集合:设置一个数组set(i=0,1,..,n-1),初始值为 0,代表对
VC7775
- 自己编写的二叉查找树,分享给想学数据结构的开发人员。包括节点插入、节点删除、最大值,最小数值,后继元素,重载标准输出操作符…… -I have written a binary search tree data structure wants to learn to share the development of staff. Including node insertion, node deletion, the maximum value, minimum value, subsequ
COIN
- 算法设计COIN程序,实现固定面值货币,兑换最少数量的程序-COIN algorithm design process, to achieve a fixed nominal value of currency, exchange a minimum number of procedures
LeastMoney
- 对于给定的1≤n≤10,硬币面值数组T和可以使用的各种面值的硬币个数数组Coins,以及钱数m,计算找钱m的最少硬币数。-For a given 1 ≤ n ≤ 10, an array of T and the nominal value of coins of various denominations can use the number of coins in an array of Coins, as well as the amount of money m, calculate t
picture
- 由于题目要求是要求最小值,如果能有一种工具能够自动将我们输入的值进行排序就好了。由此,很容易就会想到使用容器multiset,它能够将我们输入的数值自动进行从小到大的顺序进行排列。这样,当我们输入完数值后,直接调用函数begin(),取容器中的第一个值即为容器中的最小值了。-The subject requirement is to require the minimum, if there is a tool that can automatically input value like so
HaffmanTree
- 哈弗曼树的建立和实现,方法选取一个权值最小和一个权值次小的结点来构成一个新的父母结点,递归建立一颗哈夫曼树-Hafu Man tree establishment and realization of the method to select a right to the minimum value and a weight value of small nodes to form a new parent node, recursive establish a Huffman tree
select_sort
- /*选择排序 *从待排序的数中找到最小的元素,放到第一个位置, *从剩下的n - 1个元素中找到最小的元素,放到第二个位置, *依次下去,直到n - 1个元素。 *每次排序都会在待排序的元素中找出一个最小的值放到待排序的数的首段。 */-/* Sort select* find the smallest element from the number to be sorted, and placed in the first position, find the smalle
Kruskal
- 设G=(V,E)是一个具有含权边的连通无向图。G的一颗生成树(V,T)是G的作为树的子图。如给该连通图加权并且各边的权和为最小值,那么(V,T)就称为最小耗费生成树或简称最小生成树。 Kruskal的算法概况如下: 对G的边以非降序权重排列。 对排序表中的每条边,如果现在把它放入T中的话不会形成回路,则把它加入到生成树T中,否则将它丢弃。-Let G = (V, E) is an edge with the right connectivity with undire
huisufa
- 把长度为l1,l2…ln 的n个程序放在磁带T1和T2上,并且希望按照使用最大检索时间取得最小值的方式存储,即如果存放在T1和T2上的程序集合分别为A和B,则希望所选择的A和B使得max{∑li 1,∑li2}(i1属于A,i2属于B)取得最小。 使用回溯法实现。-The length l1, l2 ... ln n programs on the tape T1 and T2, and want to use the maximum search time in accordance wi
In-the-jungle-road
- 丛林中的路,利用最小生成树的prim(普利姆)算法,找最小值-Jungle road, using the minimum spanning tree prim (premium) algorithm, to find the minimum value
zuiyouhebing
- 最优合并问题,当取最小值保证每次的2个加数为最小便可,最大值同理取当前最大的两个值便可。取最小值与取最大值实现的方式不同,最小值不需要排序。-Optimal merger, when the minimum value of each guaranteed two addends can be minimum, maximum empathy take the current maximum of two values can be. Take the minimum and maximum v
