Find median of an array in c#

public static int GetMedian(int[] Value)
    {
        decimal Median = 0;
        int size = Value.Length;
        int mid = size / 2;
        Median = (size % 2 != 0) ? (decimal)Value[mid] : ((decimal)Value[mid] + (decimal)Value[mid + 1]) / 2;
        return Convert.ToInt32(Math.Round(Median));
    }

Reference: Muthukumar (http://nadarmuthukumar.blogspot.in) 
Hope you liked this and let me know your thoughts on post through your valuable comment.

Thank you

0 comments:

Twitter Delicious Facebook Digg Stumbleupon Favorites More