An Intro to Binary Trees and Binary Search Trees
Read at your own pace. Code execution, quizzes, progress tracking, and the AI tutor are available in the interactive view with JavaScript enabled.
Introduction
Trees are a very popular ADT (Abstract Data Type) used in computer science. They are organized in a hierarchy of nodes. Anything stored in a tree is represented with a node that keeps track of its own data as well as references to the location of its children. Below are the properties of a tree:
- All the nodes of a tree must be some-how connected via a path of parent-child relationship.
- There can be one and only one path between two nodes in a tree. In other words, there cannot be any cycles in a tree.

A binary tree is a data structure containing a collection of elements often referred to as nodes. It can store any data item, be it names, places, numbers, etc. of any type. It enables quick search, addition, and removal of items
It also contains a root node with a left subtree and a right subtree. A subtree is itself a binary tree and the left and right subtrees are disjoint.
Let's dive into them in this guide.
0
CONTINUE WITH ALGODAILY PREMIUM
Keep going with the complete tutorial.
Unlock the remaining explanations and exercises, alongside the full learning library.
Explore Premium →