Finding the median value of an array?

后端 未结 9 1319
伪装坚强ぢ
伪装坚强ぢ 2020-12-03 14:58

I was wondering if it was possible to find the median value of an array? For example, suppose I have an array of size nine. Would it possible to find the middle slot of this

9条回答
  •  眼角桃花
    2020-12-03 15:33

    In C++, you can use std::nth_element; see http://cplusplus.com/reference/algorithm/nth_element/.

提交回复
热议问题