01One letter per edge
A trie (prefix tree) is a tree in which every edge carries one character, so every path from the root spells a prefix. Words that start the same way share the beginning of their path: tea, ted and ten all go through t → e and split only at the last letter.
The root is empty. Each node keeps its children, one per possible next letter (an array of 26 for lowercase English, or a map), plus a flag end meaning “a whole word ends here”. The flag is essential: in and inn share the path i → n → n, and only the flags say that in and inn are words while i is not.
Building costs O(total length of all words): each insertion walks down letter by letter and creates nodes only where the path does not exist yet.