Skip to content

Instantly share code, notes, and snippets.

namespace ConsoleApplication32
{
class Program
{
static int c = 0;
public static void SortInsert(int[] a)
{
int k = 0;
for (int i=1; i<a.Length; i++)
class Program
{
static int c = 0;
public static void SortInsert(int[] a)
{
int k = 0;
for (int i=1; i<a.Length; i++)
{
static void Main(string[] args)
{
//int[] b = new int[10] { 5, 6, 4, 8, 9, 0, 3, 7, 1, 2 };
int[] b;
string s = Console.ReadLine();
string[] str = s.Split(new char[] {' '}, StringSplitOptions.RemoveEmptyEntries);
b = new int[str.Length];
for (int i = 0; i < str.Length; i++)
b[i] = Convert.ToInt32(str[i]);
ShellSort(b); //Cортировки
public static void SortBinIns(int[] b)
{
int k = 0;
for (int i = 1; i <b.Length; i++)
{
int tmp = b[i], left = 0, right = i - 1;
while ((k++ >=0)&&(left <= right))
{
int m = (left + right) / 2;
if (tmp < b[m])
public static void SortInsert(int[] a)
{
int k = 0;
for (int i=1; i<a.Length; i++)
{
int j = i - 1;
int tmp = a[i];
while ((j >= 0) && (k++ >= 0) && (a[j] > tmp))
a[j + 1]=a[j--];