
- Data Structures & Algorithms
- DSA - Home
- DSA - Overview
- DSA - Environment Setup
- Algorithm
- DSA - Algorithms Basics
- DSA - Asymptotic Analysis
- DSA - Greedy Algorithms
- DSA - Divide and Conquer
- DSA - Dynamic Programming
- Data Structures
- DSA - Data Structure Basics
- DSA - Array Data Structure
- Stack & Queue
- DSA - Stack
- DSA - Expression Parsing
- DSA - Queue
- Searching Techniques
- DSA - Linear Search
- DSA - Binary Search
- DSA - Interpolation Search
- DSA - Hash Table
- Sorting Techniques
- DSA - Sorting Algorithms
- DSA - Bubble Sort
- DSA - Insertion Sort
- DSA - Selection Sort
- DSA - Merge Sort
- DSA - Shell Sort
- DSA - Quick Sort
- Graph Data Structure
- DSA - Graph Data Structure
- DSA - Depth First Traversal
- DSA - Breadth First Traversal
- Tree Data Structure
- DSA - Tree Data Structure
- DSA - Tree Traversal
- DSA - Binary Search Tree
- DSA - AVL Tree
- DSA - Spanning Tree
- DSA - Heap
- DSA Useful Resources
- DSA - Questions and Answers
- DSA - Quick Guide
- DSA - Useful Resources
- DSA - Discussion
Balanced binary search trees in Data Structure
Here we will see what is the balanced binary search tree. The binary search trees (BST) are binary trees, who has lesser element at left child, and greater element at right child.
The average time complexity for searching elements in BST is O(log n). It is depending on the height of the binary search tree. To maintain the properties of the binary search tree, sometimes the tree becomes skewed. So the skewed tree will be look like this −
This is actually a tree, but this is looking like a linked list. For this kind of trees, the searching time will be O(n). That is not effective for binary trees.
To overcome these problems, we can create a tree which is height balanced. So the tree will not be slewed. Forcefully, we will make then balanced. So each side of a node will hold a subtree whose height will be almost same
There are different techniques for balancing. Some of them are −
AVL tree
Red-Black Tree
The height balanced form of the above example will be look like this −
- Related Articles
- Threaded Binary Trees in Data Structure
- Binary Search Trees in Data Structures
- Comparison of Search Trees in Data Structure
- Dynamic Finger Search Trees in Data Structure
- Randomized Finger Search Trees in Data Structure
- Binary Trees as Dictionaries in Data Structure
- Optimal Binary Search Trees in Data Structures
- Multidimensional Binary Search Trees
- Unique Binary Search Trees in C++
- Huffman Trees in Data Structure
- Splay trees in Data Structure
- Solid Trees in Data Structure
- Range Trees in Data Structure
- BSP Trees in Data Structure
- R-trees in Data Structure
