From the course: Data Structures in JavaScript: BSTs, Queues, and Stacks

Unlock this course with a free trial

Join today to access over 24,800 courses taught by industry experts.

Binary Search Tree functions

Binary Search Tree functions

- [Instructor] Functions, functions, read all about it. Okay, so I'm not trying to sell you anything here, but functions are a very important part of any data structure and implementing them successfully in JavaScript. In this module, you'll learn how to construct a BST and use different functions to insert nodes, search for nodes, and delete nodes. This is very important for you to know as an engineer, or when working with a team of engineers, as your data may change and need to be updated. So here you go. Feel free to code along or just watch the first time and then rewatch this module and try to code along with the video. Okay, so here we see that we have declared two classes, a node class line one and a binary search tree class starting on line eight. We are also using constructor functions. There is a declared root node on line 13. Pretty good start, wouldn't you agree? So now you need to create functions that will link the nodes to your root node. So now in line 17, there is a…

Contents