Introduction to Binary Trees
Check your understanding of binary trees.
We'll cover the following
Binary trees overview
This chapter introduces one of the most fundamental structures in computer science: binary trees. The use of the word tree here comes from the fact that, when we draw them, the resultant drawing often resembles the trees found in a forest. There are many ways of defining binary trees. Mathematically, a binary tree is a connected, undirected, finite graph with no cycles, and no vertex of degree greater than three.
For most computer science applications, binary trees are rooted: A special node, r
, of degree at most two is called the root of the tree. For every node, , the second node on the path from u
to r
is called the parent of u
. Each of the other nodes adjacent to u
is called a child of u
. Most of the binary trees we are interested in are ordered, so we distinguish between the left child and right child of u
.
Structure of binary trees
In illustrations, binary trees are usually drawn from the root downward, with the root at the top of the drawing and the left and right children, respectively given by left and right positions in the drawing below.
Create a free account to access the full course.
By signing up, you agree to Educative's Terms of Service and Privacy Policy