Implementing a Binary Search Tree in C++

In this lesson, we'll implement a very basic Binary Search Tree in C++.

Introduction #

Node Class #

To implement a BST, the first thing you’d need is a node. A node should have a value, a pointer to the left child, a pointer to the right child, and constructors to set the initial values. This node can be implemented as a class, and here is what it would look like in code.

Level up your interview prep. Join Educative to access 70+ hands-on prep courses.