Design an efficient algorithm to sort 5 distinct keys in fewer than 8 comparisons

前端 未结 13 1387
轮回少年
轮回少年 2020-12-01 11:30

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.

13条回答
  •  盖世英雄少女心
    2020-12-01 11:37

    I have written a C implementation of the solution to this problem which can be found here: Sorting 5 elements using 7 comparisons

    My code is well commented with an explanation of why it is working.

提交回复
热议问题