c语言 整型数组排序库函数_使用C ++标准库函数在线性时间中查找未排序数组的中位数...

c语言 整型数组排序库函数

Prerequisite: std::nth_element() in C++

先决条件: C ++中的std :: nth_element()

Problem statement:

问题陈述:

Find the median of an unsorted array.

查找未排序数组的中位数。

What is median?

什么是中位数?

A median is a statistical measurement that divides an ordered set of data into two halves. Median is the partitioning point for any ordered list. In the case of a sorted array median is the middle element. If the array size is odd then the median is simply the middle element and if the array size is odd then the median is the average of the two middle elements.

中位数是一种统计量度,将有序数据集分为两半。 中位数是任何有序列表的分区点。 在排序数组的情况下,中值是中间元素。 如果数组大小为奇数,则中位数仅是中间元素;如果数组大小为奇数,则中位数为两个中间元素的平均值。

Example:

例:

Array with odd size:

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值