This course has been updated into a 4 part series! We now recommend you take the A Practical Guide to Algorithms with JavaScript course.

Check out a free preview of the full Data Structures and Algorithms in JavaScript course:
The "Exercise: Binary Search Trees" Lesson is part of the full, Data Structures and Algorithms in JavaScript course featured in this preview video. Here's what you'd learn in this lesson:

In this exercise, you will create a Binary Search Tree. You will then implement the insert() and contains() methods.

Get Unlimited Access Now

Transcript from the "Exercise: Binary Search Trees" Lesson

>> Biana Gandolfo: First exercise in the morning, so we have our binary search tree. We're going to create first a binary tree, binary search tree, and then you wannna create an insert and a contains. So first you're gonna write the constructor. Don't forget the rules left and right,
>> Biana Gandolfo: For insert,

>> Biana Gandolfo: And then we're gonna do contains.