Sha256: 81d23fae459411fbc8606416af56e8e69dab3576aa4bed6d110fbd6f2737b874
Contents?: true
Size: 1.16 KB
Versions: 9
Compression:
Stored size: 1.16 KB
Contents
#pragma once #include <stdbool.h> #include <stdbool.h> #define MAX_AHO_CHILD_NODE 256 /* Character 1 byte => 256 */ struct aho_trie_node { unsigned char text; unsigned int ref_count; struct aho_trie_node* parent; struct aho_trie_node* child_list[MAX_AHO_CHILD_NODE]; struct aho_trie_node* first_child; struct aho_trie_node* last_child; struct aho_trie_node* next; unsigned int child_count; bool text_end; struct aho_text_t* output_text; /* when text_end is true */ struct aho_trie_node* failure_link; struct aho_trie_node* output_link; }; struct aho_trie { struct aho_trie_node root; }; void aho_init_trie(struct aho_trie * restrict t); void aho_destroy_trie(struct aho_trie * restrict t); bool aho_add_trie_node(struct aho_trie * restrict t, struct aho_text_t * restrict text); void aho_connect_link(struct aho_trie * restrict t); void aho_clean_trie_node(struct aho_trie * restrict t); struct aho_text_t* aho_find_trie_node(struct aho_trie_node** restrict start, const unsigned char text); void aho_print_trie(struct aho_trie * restrict t); /* TODO: * bool aho_del_trie_node(struct aho_trie* t, struct aho_text_t* text); */
Version data entries
9 entries across 9 versions & 1 rubygems