MCPcopy Create free account
hub / github.com/TheAlgorithms/Python / __init__

Method __init__

data_structures/trie/radix_tree.py:9–16  ·  view source on GitHub ↗
(self, prefix: str = "", is_leaf: bool = False)

Source from the content-addressed store, hash-verified

7
8class RadixNode:
9 def __init__(self, prefix: str = "", is_leaf: bool = False) -> None:
10 # Mapping from the first character of the prefix of the node
11 self.nodes: dict[str, RadixNode] = {}
12
13 # A node will be a leaf if the tree contains its word
14 self.is_leaf = is_leaf
15
16 self.prefix = prefix
17
18 def match(self, word: str) -> tuple[str, str, str]:
19 """Compute the common substring of the prefix of the node and a word

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected