Table of Contents

Vocabulary

Binary Search Tree (BST) Contains Insertion Finding The Min Finding The Max Removal Preorder Traversal Post Order Traversal In Order Traversal

What Is A Binary Search Tree?

<aside> 💡 A Binary Search Tree is a tree based data structure where the left child node is smaller than the parent node, but the parent node is smaller than the right child node.

</aside>

IMG_56617CC78580-1.jpeg

BST Tree Requirements

<aside> 💡 To determine if a given tree is a BST:

Binary Search Tree Requirements

  1. All nodes to the left < parent node < all nodes to the right
  2. There are no duplicate nodes.

</aside>

Examples of Trees That Meet BST Requirements

IMG_3E1D64F9BF40-1.jpeg

Examples of Trees That Don’t Meet BST Requirements

IMG_39CFBE1E4B03-1.jpeg

Code For BST Node

struct BinaryNode {
		object element;
		BinaryNode* Left;
		BinaryNode* Right;
}

Binary Search Tree Operations

Contains (Finding A Node)

<aside> 💡 Let’s find 80 in the following Binary Search Tree:

</aside>

Screenshot 2022-11-06 at 10.18.35 AM.png

Contains Code Walkthrough