Skip to content

Commit f37f0da

Browse files
committed
modified trie
1 parent 91657f9 commit f37f0da

File tree

1 file changed

+0
-11
lines changed

1 file changed

+0
-11
lines changed

pydatastructs/trees/trie.py

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -101,17 +101,6 @@ def collect_words(current_node):
101101

102102
return collect_words(self.root)
103103

104-
def shortest_unique_prefix(self, word):
105-
"""Determines the shortest unique prefix for a given word."""
106-
node = self.root
107-
prefix = ""
108-
for char in word:
109-
prefix += char
110-
if len(node.children[char].children) <= 1 and node.children[char].is_end_of_word is False :
111-
return prefix
112-
node = node.children[char]
113-
return word
114-
115104
def longest_word(self):
116105
"""Finds and returns the longest word in the Trie."""
117106
all_words = self.find_all_words()

0 commit comments

Comments
 (0)