摘要: #include #include #include unsigned int hash(char *str);enum { MULTIPLIER = 31, NHASH = 131};/* MULTIPLIER是一个计算hash值的因数,一般取31和37,NHASH是hash表的大小,最好为素数 */typedef struct Nameval Nameva... 阅读全文
posted @ 2010-03-01 01:09 莫忆往西 阅读(119) 评论(0) 推荐(0)
摘要: #include #include #include typedef struct Nameval Nameval;struct Nameval{char *name;int value;Nameval *left; /* lesser */Nameval *right; /* greater */};/* insert: insert newp in treep, return treep... 阅读全文
posted @ 2010-03-01 00:32 莫忆往西 阅读(131) 评论(0) 推荐(0)