Embercode
✕
TriesQuick quiz

Suffix tries

6 questions. Covers Suffix trie for substring queries in Python.

Questions 1 to 5 of 6

  1. 1. How many nodes does the suffix trie for aaaa have, counting the root?
  2. 2. A trie that stores only the whole text banana, not its suffixes, is asked whether nan is in the text. What does it return?
  3. 3. What does this program print? ``python class Node: def __init__(self): self.next = {} self.pass_count = 0 root = Node() nodes = 1 text = "abab" for start in range(len(text)): node = root for i in range(start, len(text)): ch = text[i] if ch not in node.next: node.next[ch] = Node() nodes += 1 node = node.next[ch] node.pass_count += 1 print(nodes, root.next["a"].pass_count) ``
  4. 4. What does this program print? ``python alphabet = "abcdefghijklmnopqrstuvwxyz" print(alphabet.find("A"), alphabet.find("z")) ``
  5. 5. Which statements about the suffix trie in this lesson are true? Pick all that apply.

    Pick every answer that is true.

5 question(s) left on this page.