public static void Test() { double[,] vv = { { 2, 7, 99, 106, 41 }, { 18, 41, 110, 112, 113 }, { 18, 41, 110, 112, 113 }, { 110, 110, 111, 112, 115 }, { 0, 3, 115, 120, 190 }, { 3, 4, 116, 101, 65 }, }; var values = new List <double>(); for (var i = 0; i < vv.GetLength(0); i++) { for (var j = 0; j < vv.GetLength(1); j++) { values.Add(vv[i, j]); } } var mediane = Quick.QuickSelectMedian(values, Quick.SelectorRandom()); }