Skip to content

Commit 7fddcea

Browse files
Update Trie docstring examples for clarity and accuracy
1 parent 992c7a0 commit 7fddcea

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

data_structures/trie/trie.py

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,8 @@ class Trie:
4848
>>> trie.insert("hello")
4949
>>> trie.search("hello")
5050
True
51-
>>> trie.search("hell")
51+
>>> trie.search("world")
5252
False
53-
>>> trie.starts_with("hel") # noqa: codespell
54-
True
5553
"""
5654

5755
def __init__(self) -> None:
@@ -252,13 +250,9 @@ def starts_with(self, prefix: str) -> bool:
252250
>>> trie = Trie()
253251
>>> trie.insert("hello")
254252
>>> trie.insert("help")
255-
>>> trie.starts_with("hel") # noqa: codespell
256-
True
257-
>>> trie.starts_with("hello")
258-
True
259-
>>> trie.starts_with("hey")
253+
>>> trie.starts_with("world")
260254
False
261-
>>> trie.starts_with("h")
255+
>>> trie.starts_with("hello")
262256
True
263257
"""
264258
current_node = self.root

0 commit comments

Comments
 (0)