本文介绍了一个人如何发现5个不同的值中位数6的比较?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可能重复:
   code来计算“中位数五&rdquo ;在C#

假如我有五个数字在列表中,说[3,2,1,4,5]。

Suppose I have five numbers in a list, say [3,2,1,4,5].

我如何找到6的比较中位数?

How do I find the median with 6 comparisons?

推荐答案

径的最佳排序的网络,对于N = 5这就要求9的比较,然后修剪为输出0,1,3和4的不必要的比较有一个例子这个它利用6比较,在回答这个问题

Take an optimal sorting network for N=5 which requires 9 comparisons and then prune the unneeded comparisons for outputs 0, 1, 3 and 4. There's an example of this which uses 6 comparisons in the answer to this question.

这篇关于一个人如何发现5个不同的值中位数6的比较?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-31 15:58