| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(sort_key_buf), | intent(in) | :: | key |
the lone integer key. |
||
| integer(kind=int64), | intent(in) | :: | n |
rows. |
||
| integer(kind=int64), | intent(in) | :: | lo |
smallest valid key value. |
||
| integer(kind=int64), | intent(in) | :: | hi |
largest valid key value. |
||
| integer(kind=int64), | intent(inout) | :: | perm(:) |
receives |
Fills perm by counting sort over lo..hi, with the nulls placed as one block.
Two O(n) passes and no comparisons at all. Stable by construction: the placement
pass walks the input in index order, so equal values are emitted in file order —
the same answer sort_row_less's index tiebreaker produces.