<DS/>DS_VISUALIZER
FoundationsOOPArraysLinked ListStacksQueuesTreesGraphsHashingStrings
exploreExplore
homechevron_rightTopicschevron_rightTreeschevron_rightBinary Search Tree
search

TREES · BST

Binary Search Tree

left < node < right — half the tree eliminated per comparison.

Choose an operation

swap_horizarrow_outward

Traversal

In-order yields sorted output.

O(n)O(h)◍ 0/6
searcharrow_outward

Search

Walk left/right by comparison — O(h).

O(h)O(1)◍ 0/6
add_boxarrow_outward

Insertion

Attach at the NULL where the search fails.

O(h)O(1)◍ 0/6
deletearrow_outward

Deletion

Leaf, one child, or two (in-order successor).

O(h)O(1)◍ 0/6