• Courses
  • Tutorials
  • DSA
  • Data Science
  • Web Tech
June 28, 2022 |4.8K Views

Pigeonhole Sort

  Share  2 Likes
Description
Discussion

Pigeonhole sorting is a sorting algorithm that is suitable for sorting lists of elements where the number of elements and the number of possible key values are approximately the same. 
It requires O(n + Range) time where n is number of elements in input array and ‘Range’ is number of possible values in array. 
Working of Algorithm : 
 

Find minimum and maximum values in array. Let the minimum and maximum values be ‘min’ and ‘max’ respectively. Also find range as ‘max-min+1’. 

Set up an array of initially empty “pigeonholes” the same size as of the range.


Pigeonhole Sort  : https://www.geeksforgeeks.org/pigeonhole-sort/