DoubleArrayTrie icon indicating copy to clipboard operation
DoubleArrayTrie copied to clipboard

insert函数问题

Open BlownSnail opened this issue 6 years ago • 0 comments

读DaTrie.java第164行时总觉得哪里不对,遂构造如下数据:

List<String> words = new ArrayList<String>();
words.add("11");
words.add("12");
words.add("3");

测试代码:

List<Integer> result = daTrie.match("112");

期望结果:

Match: {11, 12}

实际结果:

Match: {12}

根据别的文章,当发生冲突的情况下,需要寻找一个新的base,使得所有子节点的base+code未被使用,按照164行的写法,只修改了新子节点的父节点base,会造成子节点其他兄弟节点找不到新的父节点base,望作者周知。

BlownSnail avatar Sep 26 '19 01:09 BlownSnail