Explain 'Trie' (Prefix Tree) insertion.

Explain 'Trie' (Prefix Tree) insertion.

Approach: Describe walking down nodes for each character of a word.

For each character in the string, check if a child node exists. If not, create it. Move to the child node. After the last character, mark the node as the end of a word.

Follow-up: What is the time complexity for a word of length L?

Key concepts: character nodes, end-of-word marker.