- Plumbing troubles served as a good analogy for linked lists and arrays/vectors.
- Googling for plumbers in the Reno area is like an array where all data is visible at once.
- None of the plumbers had the part needed, which led to calling another plumber and asking for a referral, which is like a linked list.
- The process continued until one company told the author that the part had been recalled and they had to call the company who made the part.
- This is called a bug and the author had to pay to overnight the part.
I recently had some plumbing troubles. While I was trying to find a plumber, I realized it was a good analogy for linked lists and arrays/vectors. This should be understandable even by a layperson.
I googled for plumbers in the Reno area. The results would be like an array. I have entries 1-10 and I can see all of their data at once. It turned out that none of those plumbers had the part I needed.
I called another plumber and asked them if they knew any other business that might have the part. He said no, call company X. I called company X who said to call company Y. This is like a linked list. I have to call or ask each entry in the linked list who is the next company to call.
This continued until one company told me that the part had been recalled and I had to call the company who made the part. This is called a bug and I had to pay to overnight the part. Fortunately for our industry, most bugs can be updated with a patch and not have to ship around a part.