Common Mistakes

Common errors to avoid

  • Confusing search and startsWith: Search requires isEndOfWord check; startsWith only checks path existence.
  • Memory overhead with array children: Using 2626-element arrays wastes memory. Hash maps are more space-efficient for sparse alphabets.
  • Not marking word boundaries: Forgetting isEndOfWord flag means "app" matches when only "apple" was inserted.
  • Case sensitivity: Decide upfront if trie is case-sensitive.

Normalize input if case-insensitive.