A game that only has one character with one quest and with one shop that sells one item isn’t going to be very fun. That’s why you need to be able to work with collections of items. You have choices and this episode continues more than a week long exploration of collection types available. You’ll learn when to use each type of collection and why. Up today is another tree called a left-child right-sibling tree. I’ll explain what these trees are and then give you some guidance on when to use them.

Here’s what a left-child right-sibling tree might look like when holding some folders. This example shows a root node “C:” with two children, “Program files” and “Windows”. The “Program Files” folder has its own folder for “Office”. A real file system will have a lot more folders but it will follow this basic pattern shown below:

root -> node(C:)

node(C:).leftChild -> node(Program Files)

node(Program Files).parent -> node(C:)
node(Program Files).leftChild -> node(Office)
node(Program Files).rightSibling -> node(Windows)

node(Office).parent -> node(Program Files)

node(Windows).parent -> node(C:)