java: public static double kthSmallest(double[] v, int k) {double r = Double.NaN;int index = k-1; if (v!=null && v.length > index && index >= 0) {Arrays.sort(v);r = v[index];}return r;}
C#: public static double kthSmallest(double[] v, int k){double r = double.NaN;k--; if (v != null && v.Length > k && k >= 0){Array.Sort(v);r = v[k];}return r;}