-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMain.java
More file actions
62 lines (52 loc) · 1.9 KB
/
Main.java
File metadata and controls
62 lines (52 loc) · 1.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
import java.util.Arrays;
import java.util.Scanner;
class Main {
public static void main(String args[]) {
String option;
System.out.println("Please select the type of sorting you want to perform");
System.out.println("1.Quick Sort");
System.out.println("2.Insertion Sort");
System.out.println("3.Merge Sort");
System.out.println("4.Heap Sort");
System.out.println("5.Selection Sort");
System.out.println("6.Bucket Sort");
System.out.println("7.Counting Sort");
Scanner scanner = new Scanner(System.in);
option = scanner.next();
// INSTANCE OF QUICK SORT CLASS
if(option.equals("1")){
Quicksort quicksort = new Quicksort();
quicksort.quickSortMethod();
}
// INSTANCE OF THE SELECTION SORT CLASS
if(option.equals("2")){
InsertionSort insertionSort = new InsertionSort();
insertionSort.insertionSortMethod();
}
// INSTANCE OF THE MERGESORT CLASS
if(option.equals("3")){
mergeSort merge = new mergeSort();
merge.mergeSortMethod();
}
// INSTANCE OF THE HEAPSORT CLASS
if (option.equals("4")){
heapSort hs = new heapSort();
hs.heapSortMethod();
}
// INSTANCE OF THE SELECTIONSORT
if (option.equals("5")){
selectionSort selection = new selectionSort();
selection.selectionSortMethod();
}
// INSTANCE OF THE BUCKETSORT
if (option.equals("6")){
BucketSort bucketSort = new BucketSort();
bucketSort.bucketSortMethod();
}
// INSTANCE OF THE COUNTINGSORT CLASS
if (option.equals("7")){
CountingSort countingSort = new CountingSort();
countingSort.countingSortMethod();
}
}
}