DSAOps Lab
D
DSAOps LabTree Lab

Binary Trees

Tree Lab

Binary Tree, BST, AVL, Red-Black, Heap, Segment Tree, Trie

Walkthrough

How Trees Work

Step-by-step from basic structure to advanced operations

1

Tree Structure

A tree is a hierarchical data structure with a root node, branches, and leaves. Each node has a value and references to child nodes. Binary trees have at most 2 children per node.

50
30
70
20
40
60
80
1 / 6
Animation Speed
SlowFast

Complexity

Search (BST)
O(log n)/O(n)
Insert (BST)
O(log n)/O(n)
Delete (BST)
O(log n)/O(n)
Search (AVL/RB)
O(log n)/O(log n)
Traversal
O(n)/O(n)
Heapify
O(n)/O(n)
Segment Query
O(log n)/O(log n)

Properties

Tree Height0
Node Count0
BalancedYes

Node Colors

Normal
Inserting
Deleting
Searched
Visited