What is Tree Data Structure?
Tree Data Structure is a hierarchical data structure in which a collection of elements known as nodes are connected to each other via edges such that there exists exactly one path between any two nodes.
Basic Operations on Tree Data Structure:
Types of Tree Data Structure:
- Binary tree: In a binary tree, each node can have a maximum of two children linked to it. Some common types of binary trees include full binary trees, complete binary trees, balanced binary trees, and degenerate or pathological binary trees.
- Ternary Tree: A Ternary Tree is a tree data structure in which each node has at most three child nodes, usually distinguished as “left”, “mid” and “right”.
- N-ary Tree or Generic Tree: Generic trees are a collection of nodes where each node is a data structure that consists of records and a list of references to its children(duplicate references are not allowed). Unlike the linked list, each node stores the address of multiple nodes.
To learn more about types of trees, refer to this article.
n-ary or Generic Tree:
Binary Tree:
Binary Search Tree:
Ternary Search Tree:
AVL Tree:
B Tree:
B+ Tree:
Red-Black Tree:
Other types of Trees:
- Interval Tree:
Trees vs other Data Structures:
Comparison among different Tree Data Structures:
Problems | Difficulty Level | Solve |
Easy | ||
Easy | ||
Easy | ||
Easy | ||
Easy | ||
Easy | ||
Easy | ||
Easy | ||
Easy | ||
Easy | ||
Easy | ||
Easy | ||
Easy | ||
Easy | ||
Medium | ||
Medium | ||
Medium | ||
Medium | ||
Medium | ||
Medium | ||
Medium | ||
Medium | ||
Medium | ||
Medium | ||
Medium | ||
Medium | ||
Medium | ||
Medium | ||
Medium | ||
Medium | ||
Medium | ||
Medium | ||
Medium | ||
Medium | ||
Medium | ||
Medium | ||
Medium | ||
Medium | ||
Medium | ||
Medium | ||
Hard | ||
Hard | ||
Hard | ||
Hard | ||
Hard | ||
Hard | ||
Hard | ||
Hard | ||
Hard | ||
Hard |
Quick Links: