2012-03-21から1日間の記事一覧

C# 配列の要素からk番目の値を求めるアルゴリズム

配列の要素からk番目の値(k番目に小さい値)を求める。 k番目の「k」はもちろんゼロ起源である。 using System; public class Program { private static void Swap(ref Int32 x, ref Int32 y) { Int32 tmp = x; x = y; y = tmp; } private static Int32 Par…