Bin Sort: The Algorithm
Create an array Head[0..N-1] of N headers of empty linked lists.
Create another array (parallel to the first), Tail[0..N-1] of (initially null) links to the tails of the same lists.
For each ? key,data ? record, ? ki, di ? insert it onto the end of the list at Head[ki], (which is Tail[ki]).
Concatenate the N lists together and return this.