Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/Jack-Lee-Hiter/AlgorithmsByPython
/ make_trie
Function
make_trie
CheckErrorWord.py:8–17 ·
view source on GitHub ↗
(words)
Source
from the content-addressed store, hash-verified
6
END =
'$'
7
8
def
make_trie(words):
9
trie = {}
10
for
word in words:
11
t = trie
12
for
c in word:
13
if
c not in t:
14
t[c] = {}
15
t = t[c]
16
t[END] = {}
17
return
trie
18
19
# 容错查找
20
# 实质上是对Trie的深度优先搜索,每一步加深时就消耗目标词的一个字母
Callers
1
CheckErrorWord.py
File · 0.85
Calls
no outgoing calls
Tested by
no test coverage detected