8 questions. Covers Debugging lab: trie bugs.
Questions 1 to 5 of 8
children
is_end
python def insert(root, word): node = root for ch in word: idx = ord(ch) - ord("a") if node.children[idx] is None: node.children[idx] = Node() node = node.children[idx]
After
,
returns
ord(ch) - ord("a")
insert
search
starts_with
python def index(ch): return ord(ch) - ord("a") + 1 print(index("a"), index("z"))
python def index(ch): return ord(ch) - ord("A")
Inserting
raises
ord("A")
c
index
python def index(ch): return ord(ch) - ord("a") + 1
Words like
and
work, but
zoo
cat
z
+ 1
a
5 question(s) left on this page.