# Tag Archives: Heap Sort

Sorting refers to rearrangement of a given array or list of elements according to a comparison operator on the elements. The comparison operator is used… Read More
Given an array nums of length N which contains two types of numbers, one which has the value zero, the second which is a positive… Read More
Prerequisite:  SORT command in Linux/Unix with examples The SORT command in the Linux operating system is used for sorting. It can be done either for… Read More
Given a linked list, the task is to sort the linked list using HeapSort. Examples: Input: list = 7 -> 698147078 -> 1123629290 -> 1849873707… Read More
Given an array interval of length N, where each element represents three values, i.e. {startTime, endTime, value}. The task is to find the maximum sum… Read More
Given an array A[] consisting of N integers, the task is to find the minimum difference between the largest and the smallest element in the… Read More
Given an array arr[] consisting of N integers and an integer K, the task is to find the Kth smallest element in the array using… Read More
Given a Binary Search Tree, the task is to print the nodes of the BST in the following order: If the BST contains levels numbered… Read More
An algorithm like Heap sort can be understood easily by visualizing. In this article, a program that visualizes the Heap Sort Algorithm has been implemented.… Read More
Given two sorted arrays, we need to merge them with O(1) extra space into a sorted array, when N is the size of the first… Read More
Given an array arr[] of strings. The task is to sort the array in lexicographical order using Heap Sort.Examples:   Input: arr[] = { “banana”, “apple”,… Read More
Introsort(Introspective sort) is a comparison based sort that consists of three sorting phases. They are Quicksort, Heapsort, and Insertion sort. Basic concepts of Introsort and… Read More
Given an array of elements, sort the array in decreasing order using min heap.  Examples:  Input : arr[] = {5, 3, 10, 1} Output :… Read More
Although QuickSort works better in practice, the advantage of HeapSort worst case upper bound of O(nLogn). MergeSort also has upper bound as O(nLogn) and works… Read More
Heap sort is a comparison-based sorting technique based on Binary Heap data structure. It is similar to the selection sort where we first find the… Read More