Mark As Completed Discussion

What's a Tree Again?

Let's first revisit trees.

In programming, a tree is a hierarchical data structure with a root node (or vertex-- same thing) and corresponding child nodes. Child nodes can further have their own child nodes. Various types of trees, some which we'll explore shortly, have unique requirements around the number or categorization of its child nodes. In addition, a node with no child is typically called a leaf node.

Let's now look at one with all these types of nodes:

What's A Tree Again?

Nodes are connected to each other via edges, also called links or lines. These terms all simply refer to the connection between two vertices.

You may have also heard of traversing a tree. Traversal of a tree refers to the act of visiting, or performing an operation, at each node. Alternatively, searching a tree refers to traversing all the nodes of a tree, where each node is visited only once, to locate a specific node or value.