File PigeonholeSort.h
↰ Parent directory (ADS/sort)
Pigeonhole Sort (exercise 4.11) of the pairs ( key , value ) with keys in [ 0 , k ): the value of each pair goes at the end of the LIST of its key, then the lists are read in the order of the keys; O( n + k ) time, and stable, unlike Counting Sort, which only counts the keys.
Definition (ADS/sort/PigeonholeSort.h)
Detailed Description
The contracts [see File Contract.h]: k >= 0 and each key must be in [ 0 , k ), checked key by key, and the output has as many pairs as the input, its keys sorted. The functions are defined in PigeonholeSort.tpp.
Montresor, Algoritmi e Strutture Dati, 2025, exercise 4.11, https://algoritmicamente.it/materiali/libro/capitoli/cap04.pdf
- Donato Meoli
Dipartimento di Informatica Universita’ di Pisa
by Donato Meoli
Includes
ADS/Contract.h(File Contract.h)ADS/sequence/List.h(File List.h)ADS/sort/Sorted.h(File Sorted.h)ADS/sort/impl/PigeonholeSort.tppalgorithm(File AkraBazzi.h)stdexceptutilityvector