From a8865a50eac103c433c81771153701338a8711f4 Mon Sep 17 00:00:00 2001 From: rinat Date: Wed, 13 Mar 2024 14:05:47 +0400 Subject: [PATCH] sorts without time --- .idea/uiDesigner.xml | 124 +++++++++++++++++++++++++++++++++++++++++ src/InsertionSort.java | 0 src/Main.java | 33 ++++------- src/Node.java | 19 ------- 4 files changed, 134 insertions(+), 42 deletions(-) create mode 100644 .idea/uiDesigner.xml delete mode 100644 src/InsertionSort.java delete mode 100644 src/Node.java diff --git a/.idea/uiDesigner.xml b/.idea/uiDesigner.xml new file mode 100644 index 0000000..2b63946 --- /dev/null +++ b/.idea/uiDesigner.xml @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/InsertionSort.java b/src/InsertionSort.java deleted file mode 100644 index e69de29..0000000 diff --git a/src/Main.java b/src/Main.java index f613146..80c1fed 100644 --- a/src/Main.java +++ b/src/Main.java @@ -1,9 +1,4 @@ -import java.util.Scanner; - - - - - +import sorts.*; public class Main { public static void main(String[] args) { @@ -23,25 +18,17 @@ public class Main { } - - int n = arr.length; - for (int i = 1; i < n; ++i) { - int key = arr[i]; - int j = i - 1; - - - while (j >= 0 && arr[j] > key) { - arr[j + 1] = arr[j]; - j = j - 1; - } - arr[j + 1] = key; + MergeSort.print(arr); + MergeSort.sort(arr); + MergeSort.print(arr); + for (int i = 9; i >= 0; i--){ + arr[9 - i] = i; } + System.out.println(); + MergeSort.print(arr); + InsertionSort.sort(arr); + MergeSort.print(arr); - - - for (int i = 0; i < arr.length; i++){ - System.out.print(arr[i] + " "); - } } } \ No newline at end of file diff --git a/src/Node.java b/src/Node.java deleted file mode 100644 index 644d2a4..0000000 --- a/src/Node.java +++ /dev/null @@ -1,19 +0,0 @@ -public class Node { - private T value; - private Node next; - public T getValue() { - return value; - } - - public void setValue(T value) { - this.value = value; - } - - public Node getNext() { - return next; - } - - public void setNext(Node next) { - this.next = next; - } -}