Calculate median in c#

前端 未结 12 1490
别跟我提以往
别跟我提以往 2020-11-29 23:35

I need to write function that will accept array of decimals and it will find the median.

Is there a function in the .net Math library?

12条回答
  •  谎友^
    谎友^ (楼主)
    2020-11-30 00:02

    I have an histogram with the variable : group
    Here how I calculate my median :

    int[] group = new int[nbr]; 
    
    // -- Fill the group with values---
    
    // sum all data in median
    int median = 0;
    for (int i =0;i

    median is the group index of median

提交回复
热议问题