Suffix tree: Difference between revisions
Content added Content deleted
No edit summary |
m (→{{header|Python}}: Remove use of mutable list as argument default (otherwise all "empty" nodes share the same children list which may be mutated by the algorithm)) |
||
Line 1,082: | Line 1,082: | ||
{{trans|D}} |
{{trans|D}} |
||
<lang python>class Node: |
<lang python>class Node: |
||
def __init__(self, sub="", children= |
def __init__(self, sub="", children=None): |
||
self.sub = sub |
self.sub = sub |
||
self.ch = children |
self.ch = children or [] |
||
class SuffixTree: |
class SuffixTree: |