Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #ifndef RADIX_TRIE_H
- #define RADIX_TRIE_H
- #include <iostream>
- #include <string>
- #include <vector>
- class radix_trie {
- char Value;
- public:
- std::string children_characters;
- std::vector<radix_trie> children;
- radix_trie() { Value = 0; };
- radix_trie(char pValue) { Value = pValue; };
- ~radix_trie() {};
- void add_string(std::string input) {
- std::cout << input << std::endl;
- for( int i = 0, radix_trie* it = this; i < input.length(); i++ ) {
- if( it.children_characters.find( input[i] == std::string::npos ) ) {
- it.children_characters.append( input[i] );
- }
- else
- {
- it = it.children[it.children_characters.find(input[i])];
- continue;
- }
- it.children.push_back(it = new radix_trie(input[i]));
- }
- }
- void delete_string(const std::string input) {
- }
- };
- #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement