提交 e50d7595 编写于 作者: 邹晓航

修改命名错误

上级 785a9727
#include "../TrieTree.h" #include "../TrieTree.h"
namespace TinySTL{ namespace TinySTL{
trie_tree::trie_tree():data(new trie_node), size_(0){} trie_tree::trie_tree() :root_(new trie_node), size_(0){}
trie_tree::~trie_tree(){ trie_tree::~trie_tree(){
if (data){ if (root_){
data->map_childs.clear(); root_->map_childs.clear();
delete data; delete root_;
} }
} }
bool trie_tree::empty()const{ bool trie_tree::empty()const{
......
...@@ -24,7 +24,7 @@ namespace TinySTL{ ...@@ -24,7 +24,7 @@ namespace TinySTL{
typedef string value_type; typedef string value_type;
typedef size_t size_type; typedef size_t size_type;
private: private:
trie_node *data; trie_node *root_;
size_type size_; size_type size_;
public: public:
trie_tree(); trie_tree();
...@@ -41,7 +41,7 @@ namespace TinySTL{ ...@@ -41,7 +41,7 @@ namespace TinySTL{
bool is_existed(const string& word)const; bool is_existed(const string& word)const;
private: private:
node_ptr make_node(char ch, bool is_a_word); node_ptr make_node(char ch, bool is_a_word);
inline trie_node* get_root()const{ return data; } inline trie_node* get_root()const{ return root_; }
void _get_word_by_prefix(const string& prefix, const node_ptr& up, const string& real_prefix, vector<string>& words)const; void _get_word_by_prefix(const string& prefix, const node_ptr& up, const string& real_prefix, vector<string>& words)const;
void __get_word_by_prefix(const node_ptr& up, string& word, const string& prefix, vector<string>& words)const; void __get_word_by_prefix(const node_ptr& up, string& word, const string& prefix, vector<string>& words)const;
void _print_tree(std::ostream& os, const node_ptr& up, string word)const; void _print_tree(std::ostream& os, const node_ptr& up, string word)const;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册