一个人如何发现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...

可能重复:    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.

阅读全文

相关推荐

最新文章