You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
in the delete method of graphs_trees/trie/trie_solution.ipynb:
while parent is not None:
# As we are propagating the delete up the
# parents, if this node has children, stop
# here to prevent orphaning its children.
# Or
# if this node is a terminating node that is
# not the terminating node of the input word,
# stop to prevent removing the associated word.
if node.children or node.terminates:
return
del parent.children[node.key]
node = parent
parent = parent.parent
When you traverse from child to parent, the parent will always at least contain one child. Thus the parent.children[node.key] will never be deleted.
The text was updated successfully, but these errors were encountered:
in the delete method of graphs_trees/trie/trie_solution.ipynb:
while parent is not None:
# As we are propagating the delete up the
# parents, if this node has children, stop
# here to prevent orphaning its children.
# Or
# if this node is a terminating node that is
# not the terminating node of the input word,
# stop to prevent removing the associated word.
if node.children or node.terminates:
return
del parent.children[node.key]
node = parent
parent = parent.parent
When you traverse from child to parent, the parent will always at least contain one child. Thus the parent.children[node.key] will never be deleted.
The text was updated successfully, but these errors were encountered: