Suppose there is a sorting algorithm that in addition to regular comparisons, is also allowed super-comparisons: a super-comparison takes in three elements and outputs those elements in order from smallest to largest.
I want to find a lower bound.
Since unlike a regular comparison that only has two possible outcomes, a super-comparison will have 3! possible outcomes, I believe it should be log3(n!).
I am not sure though, any ideas?
Actually, the number of super-comparisons is
log_6(n!), this is because you have 6 possible outcomes per super-compare op, and not 3 (3! = 6). Thus, by repeatedly invoking these super-comparisons on the tree representing the random permutation, you get to a sorted array withinlog_6(n!)compare ops.Note that when it comes to asymptotic time complexity – it remains
O(nlogn)the base of the logarithm does not matter because you can switch bases easily:P.S A good intuition will be to see what happens at “infinity” i.e. what you have a super-comparison that sorts
nelements. Obviously, you will need a single such op to sort an array, and indeedlog_n!(n!) = 1, whilelog_n(n!) > 1.