This commit is contained in:
邹晓航
2015-02-14 13:47:07 +08:00
parent 02c3088e8a
commit 9a13d7acc9
4 changed files with 64 additions and 3 deletions

View File

@@ -79,6 +79,7 @@ TinySTL
* avl_tree100%
* suffix_array100%
* directed_graph100%
* trie tree100%
##TinySTL单元测试(原单元测试代码逐步)
* pair100%
@@ -97,6 +98,7 @@ TinySTL
* avl_tree100%
* unordered_set100%
* directed_graph100%
* trie tree100%
#TinySTL性能测试:
###测试环境Windows 7 && VS2013 && release模式
@@ -488,4 +490,40 @@ TinySTL
![image](https://raw.githubusercontent.com/zouxiaohang/TinySTL/master/TinySTL/ScreenShots/graph1.png)
![image](https://raw.githubusercontent.com/zouxiaohang/TinySTL/master/TinySTL/ScreenShots/graph_dfs.png)
![image](https://raw.githubusercontent.com/zouxiaohang/TinySTL/master/TinySTL/ScreenShots/graph_bfs.png)
![image](https://raw.githubusercontent.com/zouxiaohang/TinySTL/master/TinySTL/ScreenShots/graph2.png)
![image](https://raw.githubusercontent.com/zouxiaohang/TinySTL/master/TinySTL/ScreenShots/graph2.png)
####(16):trie tree
TinySTL::trie_tree t;
std::ifstream in;
in.open("C:\\Users\\zxh\\Desktop\\trie_tree_test.txt");
std::vector<std::string> v;
std::string s;
while (in){
in >> s;
v.push_back(s);
}
ProfilerInstance::start();
for (const auto& str : v){
t.insert(TinySTL::string(str.data()));
}
ProfilerInstance::finish();
std::cout << "build trie tree costs " << ProfilerInstance::millisecond() << "ms" << std::endl;
ProfilerInstance::start();
auto res = t.get_word_by_prefix("v");
ProfilerInstance::finish();
std::cout << "get word by prefix \"v\" costs " << ProfilerInstance::millisecond() << "ms" << std::endl;
auto i = 0;
for (const auto& str : res){
++i;
if (i % 10 == 0) std::cout << std::endl;
std::cout << str << " ";
}
std::cout << std::endl;
![image](https://raw.githubusercontent.com/zouxiaohang/TinySTL/master/TinySTL/ScreenShots/trie_tree.png)