随笔分类 -  搜索树

摘要:http://poj.org/problem?id=1035题意:给出一些字典单词,然后给出查询的单词temp,若字典单词中有temp就直接输出,如果没有就输出1:一个字母拼写错误;2:多添加了 一个字母;3:少了一个字母;思路:用vector存的string序列,然后用string的一些特性来判断的;代码:View Code #include <cstdio>#include <string>#include <cstring>#include <iostream>#include <cstdlib>#include <vec 阅读全文
posted @ 2012-03-25 16:07 LT-blogs 阅读(256) 评论(0) 推荐(0)
摘要:http://poj.org/problem?id=2418题意:给定一些树,按字典序输出数名和树出现的频率;思路:这个题用二叉搜索树可以做,同时在网上看到了一个简单的方法,用map来做,这里map真是太好用了;map做法:View Code #include <iostream>#include <map>#include <cstdio>#include <string>using namespace std;int main(){ string a; map<string,int>tree; double n = 0; char 阅读全文
posted @ 2012-03-23 19:26 LT-blogs 阅读(191) 评论(0) 推荐(0)