Tag Archives: Self-Balancing-BST

Tree Sort

Tree sort is a sorting algorithm that is based on Binary Search Tree data structure. It first creates a binary search tree from the elements of the input list or array and then performs an in-order traversal on the created binary search tree to get the elements in sorted order. Algorithm: Step 1: Take the… Read More »

Why is Binary Heap Preferred over BST for Priority Queue?

A typical Priority Queue requires following operations to be efficient. Get Top Priority Element (Get minimum or maximum) Insert an element Remove top priority element Decrease Key A Binary Heap supports above operations with following time complexities: O(1) O(Logn) O(Logn) O(Logn) A Self Balancing Binary Search Tree like AVL Tree, Red-Black Tree, etc can also… Read More »