Which statement best describes how a Trie stores multiple words?
Think about how characters connect to form words in a tree structure.
A Trie stores words by linking characters in nodes. Each path from the root to a node spells out a prefix or a full word.
In a Trie, how is the end of a word typically indicated?
Consider how the Trie distinguishes prefixes from complete words.
Each node has a boolean flag that marks if the path to that node forms a complete word.
After inserting the words "cat", "car", and "dog" into an empty Trie, how many children does the root node have?
Look at the first letters of each word.
Words "cat" and "car" start with 'c', so one child node for 'c'. "dog" starts with 'd', so another child node for 'd'. Total 2 children.
What happens when you search for the word "bat" in a Trie that contains only "cat" and "car"?
Check if the first character of the search word exists in the Trie.
The Trie has no child node for 'b' at the root, so "bat" cannot be found.
Starting with an empty Trie, you insert the words: "to", "tea", "ted", "ten", and "inn". How many nodes does the Trie contain after all insertions?
Count shared prefixes carefully to avoid double counting nodes.
Words share prefixes: "to" and "tea", "ted", "ten" share 't' and 'e'. Counting unique nodes results in 10 nodes total.