Skip to content

insert函数问题 #1

@BlownSnail

Description

@BlownSnail

读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,望作者周知。

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions