I am trying to do trie in C ++, now my main data structure looks like this:
struct node{ int count; no of times this node has been visited. struct node* child[ALPHABET_SIZE];
When the line size becomes large, most of the allocated memory is lost. For example, if we insert "he" Our tree will be
root---->h--->e |--->e
We see that only 2/26th allocated memory is used in the root. How to improve? .
source share