自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(16)
  • 资源 (2)
  • 收藏
  • 关注

转载 滑雪问题的几个解法

Michael喜欢滑雪百这并不奇怪, 因为滑雪的确很刺激。可是为了获得速度,滑的区域必须向下倾斜,而且当你滑到坡底,你不得不再次走上坡或者等待升降机来载你。Michael想知道载一个 区域中最长底滑坡。区域由一个二维数组给出。数组的每个数字代表点的高度。下面是一个例子 1 2 3 4 516 17 18 19 615 24 25 20 714 23 22 21 813 12 11 10

2008-03-31 22:04:00 1092

转载 一个典型的动态规规划用

 DP 有两种类型,一种是:Top-Down 一种是:Bottom-Up 。 DP 的典型的应用有几种: 1、Coin change : is the problem of finding the number of ways of making changes for a particular amount of cents,n, using a given set of denominatio

2008-03-26 21:58:00 590

转载 Longest Increasing Subsequence

   传统上解决longest incresing subsequence 的算法的时间复杂度是O(n^2) ,算法如下:int lcs( int* a, int N ) {   int *best, *prev, i, j, max = 0;   best = (int*) malloc ( sizeof( int ) * N );   prev = (int*) malloc ( si

2008-03-26 18:01:00 883

转载 Josephus问题的数学方法

 

2008-03-26 15:27:00 748

转载 Floyd-Warshall 算法

     Floyd-Warshall 算法用来找出每对点之间的最短距离。它需要用邻接矩阵来储存边,这个算法通过考虑最佳子路径来得到最佳路径。 注意单独一条边的路径也不一定是最佳路径。 从任意一条单边路径开始。所有两点之间的距离是边的权,或者无穷大,如果两点之间没有边相连。 对于每一对顶点 u 和 v,看看是否存在一个顶点 w 使得从 u 到 w 再到 v 比己知的

2008-03-26 13:27:00 874

转载 Longest Common Subsequence

       递归的解法是:#include stdio.h>int inline max(int a,int b){        return a >= b ? a : b;}int lcs(char * a, int la, char *b, int lb){        if(la  0 || lb  0 ) return 0;        if(a[la] == b[lb])

2008-03-25 20:53:00 575

转载 lzw 压缩算法源代码

   lzw 压缩算法源代码: /************************************************************************ Copyright (c) 1989 Mark R. Nelson**** LZW data compression/expansion demonstration program.**** April 13, 

2008-03-20 22:00:00 2391 2

原创 Hash 函数大全

看到了几个Hash 函数的计算方法,因此想把所见到的所有Hash code 的计算方法的算法罗列出来。会陆续追加看到的Hash 的算法。 第一种:  这是MySql 中计算Hash Code 的一个代码 inline Uint32 Hash( const char* str ){  Uint32 h = 0;  Uint32 len = strlen(str);  while(

2008-03-20 13:22:00 1140

原创 找出整数数组中两个数差值的绝对值最小

       有一个整数数组,请求出两两之差绝对值最小的值,记住,只要得出最小值即可,不需要求出是哪两个数。 下面是一个结发了,利用了stl 的sort 来晚成排序。#include iostream>#include vector>#include ctime>#include cstdio>#include cmath>using namespace std;#define N 100

2008-03-19 16:29:00 9158 2

原创 switch-case 这样的语法

          第一次见到这种switch-case 的语法是在linux source code 中,自己仿真写了一个小测试程序。#include stdio.h>int main(){ int nr =rand() % 128; int *idx = &nr; switch (nr) {  case   1        : *idx = 0; break;  case   2  

2008-03-19 14:06:00 1208

原创 任意长度正整数加法

    任意长度加法的实现,没有考虑负数的情况。#include iostream>#include stack>#include string>using namespace std;int inline cti(char c){ return (c - 0);}int main(){ string a,b,max,min; int i, len ,cr ,tmp; stackint

2008-03-19 09:53:00 648

原创 判断一个数字是否是回文

据说是HuaWei 面试试题,不知道真假了。#include stdio.h>int check(int m){        int n =m ,i,d = 0;        while(n)        {                d = d * 10 + n %10;                n /= 10 ;        }        return (d ==

2008-03-18 21:43:00 722

转载 学好英语的18条黄金法则

1.What is language for? Some people seem to think it is for practicing grammar rules and learning lists of words--the longer the words the better. That’s wrong. Language is for the exchange of ide

2008-03-18 13:19:00 509

原创 Auction

Problem A: AuctionRecently the auction house has introduced a new type of auction, the lowest price auction. In this new system, people compete for the lowest bid price, as opposed to what they did

2008-03-16 14:02:00 751

原创 一个分糖果游戏的解法

 所有学生以圆形围着老师,每个学生开始时均有偶数块糖果,老师每吹一次哨子,每位学生拿出手中一半糖果给右侧的同学,对任何一个学生,吹哨后,当手中的糖果数为奇数块时,由老师补一块给他(她),这样下去,当每个学生手中的糖果数相同时,游戏结束.输入要求:游戏测试不止一个,对于每个游戏测试,输入学生人数N,开始时每个学生手中的糖果数分别为多少(EVEN),输入学生人数为"0"时,测试结束.输出要求:对每个游

2008-03-15 21:07:00 1810

原创 Revser single link example code

      单链表倒序: #include stdio.h>struct link{ int value; struct link * next;} ;void output_link(struct link * head){ printf(" "); while(head != NULL) {  printf(" [%d] ", head->value);  head = head->n

2008-03-15 15:40:00 915 1

消息驱动系统实现模型

msg.h/msg.c/modules.c/modules.h 这是个文件实现了消息驱动系统模型。 整个package 是一个VC 项目,可以测试上面的模型。

2011-12-29

带有保存SSH登录 密码的 Putty

在工作中几乎离不开Putty,Putty 可以说最好用的SSH 客户端,由于安全方面的设计考虑,Putty 不支持SSH 登录密码保存,网上也有一些人有这方面的需求。 尽管可以通过设置Private key 的方式来实现自动登录,不过从方面性的角度而言,还是能够支持保存密码自动登录的方式较为方便。所输入的密码通过AES 加密保存起来。有任何bug,请email 告知我。

2008-05-28

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除