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

Pigeonhole Sort

  Share   Like
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/