I am trying to find the best algorithm for the next sorting task.
The audience has strong> N = K Γ M places with one pass, K and M places in the aisle. It is assumed that K is larger than M , but I do not think it is very important. There are N people who are in bijection with seats (designated places). Assuming that people are not as expectation, what is the fastest way to build them in order to get them all in their places as quickly as possible?
I did some simple experiments (using random permutations), and it seemed like letting them line up randomly faster than having people in the front third (further down the aisle) line up first, then the middle third, then the third third. This seems to me wrong.
I write this in MatLab, if that matters at all. Any ideas or answers?
sorting algorithm matlab permutation
Daniel
source share