Since you asked about methods based on matching, Iβm going to make the usual assumptions that (1) elements can be compared but not hashed (2), the only interesting resource is tripartite operations.
In the absolute sense, grouping is easier than sorting. Here's a grouping algorithm for three elements using one comparison (sorting requires three). When entering x, y, z , if x = y , return x, y, z . Otherwise, return x, z, y .
Asymptotically, however, grouping and sorting requires Omega(n log n) comparisons Omega(n log n) . The lower bound method is an information-theoretic one: we prove that for each grouping algorithm expressed as a decision tree, there is a 3^Omega(n log n) leaf, which means that the height of the tree (and, therefore, the worst running time of the algorithm) Omega(n log n) .
Fix an arbitrary leaf of the decision tree where no input element was found. Input positions are partially ordered by the inequalities found.
Assume the contrary that i, j, k are pairwise incomparable input positions. If we leave x = input[i], y = input[j], z = input[k] , the possibilities x = y < z and y = z < x and z = x < y are consistent with what the algorithm observed. This cannot be, since it is impossible for one order selected by the sheet to place x next to y next to z next to x . We conclude that the partial order does not have antichannel power of three.
Dilworth's theorem , partial order has two chains that span the entire input. Considering all possible ways of combining these chains in full order, there are no more than n choose m β€ 2^n permutations that are displayed on each sheet. Thus, the number of leaves is at least n!/2^n = 3^Omega(n log n) .