Introduction
Explore the fundamental concepts of binary trees, including node depth, tree height, and different types like full and complete binary trees. Learn to implement binary trees in Python by creating Node and BinaryTree classes. This lesson prepares you to understand tree traversal methods in upcoming lessons.
We'll cover the following...
We'll cover the following...
A binary tree is a tree data structure in which each node has at most two children, which are referred to as the left child and the right child. Have a look at an elementary example of a binary tree:
Here is another example of a binary tree that introduces us to other related terminologies:
Depth of a Node #
The length of the path from a node, n, to the root node. The depth of the root node is 0.