Re: Trie Data Structure

2020-02-08 Thread Soumen Khatua
Sorry. But I don't have any mail in my inbox from your side. Thank you On Sat 8 Feb, 2020, 5:49 PM onlinejudge95, wrote: > I am ready to answer your question, but not here it's a Django User's > Group. The question you are asking is about implementation of an algorithm > which is language agn

Re: Trie Data Structure

2020-02-08 Thread onlinejudge95
I am ready to answer your question, but not here it's a Django User's Group. The question you are asking is about implementation of an algorithm which is language agnostic. Technically, it shouldn't be asked in the Python Mailing list too. Keep a watch on your inbox though. :) Thanks, onlinejudge

Trie Data Structure

2020-02-08 Thread Soumen Khatua
from collections import defaultdict class TrieNode(): def __init__(self): self.children = defaultdict() self.terminating = False class Trie(): def __init__(self): self.root = self.get_node() def get_node(self): return TrieNode() def get_index(self, ch): return ord(ch) - ord('a') def insert