A binary trees largely resembles a regular tree, or a family tree. The top part of a binary tree is called "the root" in regards to the tree analogy, or the "parent" when considering a family tree. Each "box" in a binary tree has certain features. It has a "cargo", "left", and "right". Each box branches off to point to the other boxes, if available. Left and right are the children pointing to the following boxes. The default value of the left and right children is None; when no preceding boxes are found. When left and right are both None, the whole box "child" is said to be a leaf.
What might be confusing to some, myself included, is that linked lists largely resemble binary trees in their arrangement and general structure. However, linked lists do not have left and right children; they occur when a parent only has one child to point to, which is in the form of a list.


No comments:
Post a Comment