- 浏览: 12567 次
- 性别:
- 来自: 武汉
最新评论
文章列表
///要求:求串s到串t编辑距离并输出一种编辑方法。
///编辑距离就是用来计算从原串(s)转换到目标串(t)所需要的最少的插入,删除和替换的数目,在NLP中应用比较广泛。
#include <iostream>
#include <string.h>
using namespace std;
//存储操作信息;
struct OperInfo
{
int oper; //操作类型,0:无操作、1:delete,2:insert,3:replace;
int i; //当前操作处于源串第i位;
int j; //当前操作处于目的串 ...
#include <iostream>
using namespace std;
#define LENGTH1 6
#define LENGTH2 10
typedef struct node{
int data;
node* next;
} *List;
//typedef node* List;
List mergeList(List &list1,List &list2)
{
List list,temp;
List tempList=new node;
lis ...
- 2009-09-11 15:25
- 浏览 2319
- 评论(0)
如果你已经过了20岁但还不到25岁的话,你必须找到除了爱情之外,能够使你用双脚坚强站在大地上的东西。你要找到谋生的方式。现在考虑不晚了。
我从来不以为学历有什么重要,天才都不是科班,但,不是科班,连龙 ...
- 2009-07-14 10:40
- 浏览 1480
- 评论(0)
/*
*产生 0~n-1 范围内的 m 个随机整数的有序列表,且不允许重复,m <= n
*注:参考<<Programming Pearls>>一书
*/
#include <iostream>
#include <set>
#include <ctime>
#include <algorithm>
using namespace std;
//产生较大的随机数
int bigrand()
{
return RAND_MAX*rand()+rand();
}
//随 ...
- 2009-06-19 14:14
- 浏览 1657
- 评论(0)
/*
Name: 向量旋转算法集锦
Copyright: 始发于goal00001111的专栏;允许自由转载,但必须注明作者和出处
Author: goal00001111
Date: 28-12-08 23:28
Description:
向量旋转算法:将具有n个元素的向量a向左旋转r个位置。
例如 :将字符串"abcdefghij"旋转成"defghjabc",其中n=10,r=3。
其实就是将 AB 转换成 BA 的过程,这里A ="abc", B="defghij& ...
- 2009-06-18 13:48
- 浏览 2291
- 评论(0)
利用十进制数的这个特性检验几个数相加、相减、相乘的结果对不对,这种检查方法叫:弃九法。
例如,用弃九法检验乘式5483×9117=49888511是否正确?
因为 5483≡5+4+8+3≡11≡2(mod 9),
9117≡9+1+1+7≡0(mod 9),
所以 5483×9117≡2×0≡0(mod 9).
但是 49888511≡4+9+8+8+8+5+1+1≡8(mod 9),所以5483×9117≠49888511,即乘积不正确。
要注意的是弃九法只能知道原题错误或有可能正确,但不能保证一定正确。
弃九法原理:
(1)先证明十进制数的一个 ...
- 2009-06-17 16:41
- 浏览 3692
- 评论(0)