If you already know what a binary tree is, but not a general tree, then pay close attention, because binary trees are not just the special case of general trees with degree two. I use the definition of a tree from the textbook, but bear in mind that other definitions are possible.
Definition. A tree consists of a (possible empty) set of nodes. If it is not empty, it consists of a distinguished node r called the root and zero or more non-empty subtrees T1, T2, …, Tk such that there is a directed edge from r to each of the roots of T1, T2, …, Tk.Definition. A forest is a collection of trees. You can always create a tree form a forest by creating a new root node and making it the parent of the roots of all of the trees in the forest. Conversely, if you lop off the root of a tree, what is left is a forest.
I assume that you are familiar with the terminology of binary trees, e.g., parents, children, siblings, ancestors, descendants, grandparents, leaf nodes, internal nodes, external nodes, and so on, so I will not repeat their definitions here. Because the definitions of height and depth may vary from one book to another, I do include their definitions here, using the ones from the textbook.
Definition. A path from node n1 to node nk is a sequence of nodes n1, n2, …, nk such that ni is the parent of ni+1 for 1 ≤ i < k. The length of a path is the number of edges in the path, not the number of nodes. Because the edges in a tree are directed, all paths are “downward”, i.e., towards leaves and away from the root. The height of a node is the length of the longest path from the node to any of its descendants. Naturally the longest path must be to a leaf node. The depth of a node is the length of the path from the root to the node. The root has depth 0. All leaf nodes have height 0.
The height of a tree is the height of its root. The degree of a node is the number of children of the node. The degree of a tree is the maximum degree of the degrees