mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-02-25 10:28:39 +00:00
Compare commits
2 Commits
4f29d209c8
...
d918fcbf65
Author | SHA1 | Date | |
---|---|---|---|
|
d918fcbf65 | ||
|
a5b986831b |
@ -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
|
||||||
|
Loading…
x
Reference in New Issue
Block a user