Please correct if I am wrong
Line 10: “.insert” has 2 parameter → 1st index where we need to insert the element and 2nd is the element itself, but here why are we inserting the whole “s” and then the index position for that s?
We are not inserting “s” as a whole. We pass “s” together with the index so we know which element of the s-collection needs to be added to the tree
This site is so unfinished. The example literally references self.freq
without implementing it.
Agreed. The trie article is rushed and unfinished, it also doesn’t cover the case of a word being a prefix of another word, e.g. “he” and “hello”. Not what I was expecting from a paid service (algo.monster)