Grokking Data Structures & Algorithms for Coding Interviews
Vote

0% completed

​

Binary Search Tree (BST)

Introduction to Binary Search Tree (BST)

A Binary Search Tree (BST) is a fundamental data structure that organizes elements in a hierarchical manner, allowing for efficient searching, insertion, deletion, and traversal operations. In this section, we will explore the characteristics of a BST, its benefits, applications, ADT operations, time and space complexity, as well as potential issues and solutions.

Definition and Characteristics of BST

A Binary Search Tree is a binary tree in which each node has at most two children, referred to as the left child and the right child

.....

.....

.....

Like the course? Get enrolled and start learning!
A

Anonymous

· 2 years ago

In order to meet BST conditions, value of left subtree must be less than or equal to parent node. The insertion code in python3 only checks for < condition but for equals to condition it assigns the node in right subtree.

Correct code should be ?

while current is not None: parent = current if value > current.data: current = current.right else: current = current.left
A

Anonymous

· 2 years ago

For the BST lesson, I think the written text is meant for C++ other language instead of Python. As it is saying Search() is using recursion, while the Python code is using Iteration I'm pretty sure. Just thought I should point out, because it might be confusing for some people

Show 1 reply

Reading Progress

0%


Vote for new content