Architecture of a two-dimensional sorting algorithm