Compare commits

...

2 Commits

Author SHA1 Message Date
furthermares
d918fcbf65 improve doctest readability 2023-07-24 18:23:36 +09:00
furthermares
a5b986831b Add a doctest for previous fix 2023-07-24 17:54:13 +09:00

View File

@ -54,6 +54,13 @@ class RadixNode:
word (str): word to insert word (str): word to insert
>>> RadixNode("myprefix").insert("mystring") >>> RadixNode("myprefix").insert("mystring")
>>> root = RadixNode()
>>> root.insert_many(['myprefix', 'myprefixA', 'myprefixAA'])
>>> root.print_tree()
- myprefix (leaf)
-- A (leaf)
--- A (leaf)
""" """
# Case 1: If the word is the prefix of the node # Case 1: If the word is the prefix of the node
# Solution: We set the current node as leaf # Solution: We set the current node as leaf