Getting started
Sorting
Bubble sort
Algorithm complexity
Graphs
Dynamic programming
Kruskals algorithm
Greedy algorithms
Searching
Big O notation
Bellman-For Algorithm
Merge Sort
Binary Search Trees
Trees
Insertion Sort
Hash Functions
Traveling Salesman
Substring Search
Dijkstras Algorithm
Floyd-Warshall Algorithm
Breadth-First Search
Bucket Sort
Quicksort
Depth-First Search
Knapsack Problem
Counting Sort
Cycle Sort
Heap Sort
Heap Sort
Heap Sort Basic Information
C Implementation
Prims Algorithm
Matrix Exponentiation
Pigeonhole Sort
Radix Sort
Equation Solving
Odd-Even Sort
Pseudocode
Catalan Number Algorithm
Integer Partition Algorithm
A* Pathfinding
Shell Sort
Selection Sort
Pancake Sort
Longest Common Subsequence
Longest Increasing Subsequence
Maximum Path Sum Algorithm
Maxiumum Subarray Algorithm
Dynamic Time Warping
Pascal Triangle
Line drawing
Shortest Common Supersequence
Sliding Window Algorithm
Application of greedy techniqe
Online algorithms
Fast Fourier Transform
A* Path-finding Algorithm
Check if tree is BST
Binary tree traversal
Lowest common ancestor of a binary tree
Graph Traversal
Minimum Vertex Cover
Multi-threaded Algorithms
Print MxN matrix in square wise
Check two strings are anagrams
Edit Distance Dynamic Algorithm
Applications of Dynamic Programming
Knuth Moriss Pratt
Contributors

Heap Sort Basic Information

suggest change

Heap sort is a comparison based sorting technique on binary heap data structure. It is similar to selection sort in which we first find the maximum element and put it at the end of the data structure. Then repeat the same process for the remaining items.

Pseudo code for Heap Sort:

function heapsort(input, count)
    heapify(a,count)
    end <- count - 1
    while end -> 0 do
    swap(a[end],a[0])
    end<-end-1
    restore(a, 0, end)

function heapify(a, count)
    start <- parent(count - 1)
    while start >= 0 do
        restore(a, start, count - 1)
        start <- start - 1

Example of Heap Sort:

Auxiliary Space: O(1)

Time Complexity: O(nlogn)

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:


Heap Sort Basic Information

Table Of Contents