Отправили в Украину умирать. Убивать других. Чем скорее вы скажете своей власти, что войну нужно немедленно остановить – тем больше ваших людей останутся живыми.
Мы видим, что действительно есть выступления ваших граждан против войны. И мы знаем, что многие в России сейчас просто шокированы подлостью и жестокостью власти. И это очень правильная реакция. Я благодарю вас за эту реакцию! Спасибо Леониду Парфёнову, Дмитрию Муратову, Юрию Дудю, Лие Ахеджаковой, Валерию Меладзе – ну, и тысячам. Тысячам достойных других россиян, чья совесть звучит – звучит громко.
Просто остановите тех, кто лжет вам. Лжет нам. Лжет всему миру.
Нужно закончить эту войну. Мы можем жить в мире. В мире глобальном. В мире человечества".
Gnome sort – an easy-to-implement array sorting algorithm, named after the garden gnome, which supposedly sorts garden pots using this method.
The algorithm finds the first pair of unsorted array elements and swaps them. This takes into account the fact that the obstruction leads to an incorrect arrangement of elements adjacent on both sides to the newly rearranged ones. Since all elements of the array after rearranged are not sorted, it is necessary to double-check only the elements before rearranged.
using System;
class program
{
// method for exchanging elements
static void Swap(ref int item1, ref int item2)
{
var temp = item1;
item1 = item2;
item2 = temp;
}
// Gnome sort
static int[] GnomeSort(int[] unsortedArray)
{
var index = 1;
var nextIndex = index + 1;
while (index < unsortedArray.Length)
{
if (unsortedArray[index - 1] < unsortedArray[index])
{
index = nextIndex;
nextIndex++;
}
else
{
Swap(ref unsortedArray[index - 1], ref unsortedArray[index]);
index--;
if (index == 0)
{
index = nextIndex;
nextIndex++;
}
}
}
return unsortedArray;
}
static void Main(string[] args)
{
Console.WriteLine("Gnome sorting");
Console.Write("Enter elements of the array:");
var parts = Console.ReadLine().Split(new[] { "", ",", ";" }, StringSplitOptions.RemoveEmptyEntries);
var array = new int[parts.Length];
for (int i = 0; i < parts.Length; i++)
{
array[i] = Convert.ToInt32(parts[i]);
}
Console.WriteLine("Sorted array: {0}", string.Join(",", GnomeSort(array)));
Console.ReadLine();
}
}