Design an efficient algorithm to sort 5 distinct – very large – keys less than 8 comparisons in the worst case. You can’t use radix sort.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Compare A to B and C to D. WLOG, suppose A>B and C>D.
Compare A to C. WLOG, suppose A>C.
Sort E into A-C-D. This can be done with two comparisons.
Sort B into {E,C,D}. This can be done with two comparisons, for a total of seven.