public MainWindow() { InitializeComponent(); labelBubbleSpeed.Content = ""; labelInsertionSpeed.Content = ""; labelQuickSpeed.Content = ""; labelShellSpeed.Content = ""; textBoxSource.Text = string.Empty; textBoxSorted.Text = string.Empty; if (int.TryParse(textBoxCountElement.Text, out int count)) { Sort = new SortingArray(); Sort.GetNewArray(count); } else { MessageBox.Show("Количество элементов массива должно быть числом"); //buttonSort.IsEnabled = false; } // OriginalArray = GetNewArray(LenghtArray); }
static void Main(string[] args) { SortingArray obj = new SortingArray(); obj.FindHighestNo(); Console.WriteLine(obj.FindLowestNo()); }
public void FindMaximumCountInArray() { var sortingArray = new SortingArray(); var result = sortingArray.FindMaximumCountInArray(new int[] { 2, 1, 2, 5, 2, 1, 5, 9, 1, 1 }); Assert.AreEqual(4, result); }
void InitObjects() { DrawingStyler.style = DrawingStyle.Default; currentArray = new SortingArray(defaultArraySize); graph = DisplayBox.CreateGraphics(); controller = new Controller(graph, currentArray, GetTrackbarDelay()); }
public void Sort() { var sortingArray = new SortingArray(); var result = sortingArray.Sort(new int[] { 2, 1, 2, 5, 2, 1, 5, 9, 1 }); Assert.AreEqual(1, 1); }
void AppendArray() { int size = (int)ArrayLengthNumeric.Value; if (currentArray == null) { currentArray = new SortingArray(size); } else { currentArray.Recreate(size); } }
private void sizeTrackBar_ValueChanged(object sender, EventArgs e) { Random rnd = new Random(); size = sizeTrackBar.Value; array = Enumerable.Range(1, size).OrderBy(x => rnd.Next()).ToArray(); SizeBox.Text = "Array size: " + size.ToString(); topArray = new SortingArray(array); topArray.Subscribers.Add(picBoxArray1); picBoxArray1.ArrayModel = topArray; bottomArray = new SortingArray(array); bottomArray.Subscribers.Add(picBoxArray2); picBoxArray2.ArrayModel = bottomArray; topArray.notifySubscribers(); bottomArray.notifySubscribers(); }
public Form1() { InitializeComponent(); Random rnd = new Random(); size = sizeTrackBar.Value; array = Enumerable.Range(1, size).OrderBy(x => rnd.Next()).ToArray(); SizeBox.Text = "Array size: " + size.ToString(); topArray = new SortingArray(array); topArray.Subscribers.Add(picBoxArray1); picBoxArray1.ArrayModel = topArray; bottomArray = new SortingArray(array); bottomArray.Subscribers.Add(picBoxArray2); picBoxArray2.ArrayModel = bottomArray; topArray.notifySubscribers(); bottomArray.notifySubscribers(); }
public static void Main(string[] args) { var myClass = new SortingArray(); var myHelperClass = new HelperClass(); Console.Write("Enter the length of the array: "); int arrayLenght = int.Parse(Console.ReadLine()); int[] array = myHelperClass.GenerateRandomArray <int>(arrayLenght, arrayLenght * 2); Console.Write("Enter start position: "); int startPosition = int.Parse(Console.ReadLine()); Console.Write("Enter end position: "); int endPosition = int.Parse(Console.ReadLine()); Console.WriteLine(); myHelperClass.PrintArray(array); Console.WriteLine(); int maxNumberIndex = myClass.FindMaxIntInSubarray(array, startPosition, endPosition); Console.WriteLine("Max number is {0}", array[maxNumberIndex]); int[] sortedArray = myClass.SortArray(array); Console.WriteLine(); Console.WriteLine("Array sorted ascending:"); myHelperClass.PrintArray(sortedArray); Console.WriteLine(); sortedArray = myClass.SortArray(array, false); Console.WriteLine(); Console.WriteLine("Array sorted descending:"); myHelperClass.PrintArray(sortedArray); Console.WriteLine(); }
static void Main(string[] args) { SortingArray ob = new SortingArray(); ob.Find2ndHighestNo(); }