Skip to content

Commit

Permalink
After deleting, there are redundant node
Browse files Browse the repository at this point in the history
  • Loading branch information
HuginChen committed Dec 5, 2020
1 parent 1a2de0c commit 12a8287
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions radix.go
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,7 @@ func (t *Tree) deletePrefix(parent, n *node, prefix string) int {
n.edges = nil // deletes the entire subtree

// Check if we should merge the parent's other child
parent.delEdge(n.prefix[0])
if parent != nil && parent != t.root && len(parent.edges) == 1 && !parent.isLeaf() {
parent.mergeChild()
}
Expand Down

0 comments on commit 12a8287

Please sign in to comment.