A search that builds nodes
transcript
You search for a word that is not stored. Your code makes a node on the way. Now the trie holds something new.
Only car is stored. Search for cat. The edge t is missing. Bad code makes the node t here. Now starts with c a t says yes. Nobody ever inserted cat. Later answers now rest on a wrong node. One search changed what is stored.
Search for cat again. The edge t is missing. Stop here. Change nothing. Answer no. Now the trie is exactly as it was.
A search only reads the trie. Only insert may make a node. Stop at a missing edge. A read must leave things as they were. Only a write may change the trie.
One stray node breaks later answers. And no error tells you. Count the nodes before and after. Build it yourself in the lab. Full breakdown in the lecture.