static class Task4_4 { public static int BinSearch(IEnumerable collection, int target, int left, int right) { if (left > right) return left; // позиция для вставки var mid = (left + right) / 2; var value = collection.ElementAt(mid); if (value == target) return mid; if (value < target) return BinSearch(collection, target, mid + 1, right); return BinSearch(collection, target, left, mid - 1); } }