【发布时间】:2013-08-08 20:48:55
【问题描述】:
我正在尝试在 c++ 中进行尝试,现在我的基本数据结构看起来像..
struct node{
int count; no of times this node has been visited.
struct node* child[ALPHABET_SIZE]; // Let ALPHABET_SIZE be 26
}
当字符串变大时,会浪费大量分配的内存。就像我们插入 "he"
我们的树将是
root---->h--->e
|--->e
我们看到在根目录中只有2/26th 分配的内存被使用了。 如何改进??。
【问题讨论】: