During a recent holiday trip, little Timmy asked how Santa can visit every house in just one night. The room went silent as the adults tried to figure out how to answer this common question. Some adults started talking, but quickly trailed off. After a few seconds, Programmer Uncle Henry just went off.
"It's all in how the visits are organized. So, you know how basic B-Trees work, right? A tree structure grouped by nodes and etc. That helps group which houses to visit, and when, to keep Sanata on track. BUT! Santa uses a B+ Tree which uses pointers to really organize where he goes. That's the key to Santa's throughput. The pointers represent states, or small countries. I'm sure he started with a standard Binary-Search tree. But there's too many people now. Everyone has to modernize eventually." This went on for far too long.
Before little Timmy could walk away, Uncle Henry went on, "And he doesn't have to visit every house, which keep the dataset smaller. Optimizations like that really keep him on target. Some people don't celebrate Christmas or maybe Santa misses one." It was at this moment little Timmy started crying, "Will Santa forget to come to our house?!" The cries getting louder each passing second.
"No, no, of course not. There are redundant processes to ensure that doesn't happen. When he gets to a neighborhood, he clones himself and visits each house in a recursive manner. This way it's guaranteed he makes it to every house. Obviously we know addresses aren't immutable. So if the collection of homes has changed between the start and end of his process, Santa checks the hash. Each neighborhood has a hash value, and before leaving, the computer in Santa's sleigh ensures the hashes match. If not, he knows he missed one and does the recursive visit process again for the new homes. Nothing to worry about little Timmy."
When asked if he liked Uncle Henry's explanation, little Timmy said, "No! I wish everyone was fighting instead, like at Thanksgiving. I don't know what a hash is, or why Santa is like a traveling salesman."