What is the algorithm to sort 5 elements in 7 binary comparisons?

949 Views Asked by At

I'm tasked with finding the algo that sorts 5 elements in 7 binary comparisons. (The 7 is derived from ceilingFunction(log 5!), which our text states is the minimum number of comparisons required for this problem)

I can't do it in less than 8... you need 4 just to get a min or max value for the list. Is there a definitive solution to this? Thanks in advance...