Implementing a Binary Search Tree in Python

In this lesson, we'll implement a very basic Binary Search Tree in Python

Introduction #

The Node Class #

To implement a BST, the first thing you’d need is a node. A node should have a value, a left child, a right child, and a parent. This node can be implemented as a Python class and here is the code.

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