左程云基础班——前缀树
https://www.bilibili.com/video/BV13g41157hK?p=10&share_source=copy_web
1. 前缀树结点
边代表字母,结点存边的信息
private static class TreeNode {
public int pass;//经过此结点的边的数量
public int end;//以此边为结束
public TreeNode[] nexts;
public TreeNode() {
this.pass = 0;
this.end = 0;
this.nexts = new TreeNode[26];
}
}
2. CURD的实现
定义头结点
private TreeNode root;
1)增加前缀
public void insert(String word