FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
MaksJavaGradle/Main.java at main · MakWigglz/MaksJavaGradle · GitHub
MakWigglz
MaksJavaGradle
Repository navigation
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
MaksJavaGradle
/
Main.java
Copy path
More file actions
More file actions
Latest commit
History
History
History
55 lines (48 loc) · 1.18 KB
Breadcrumbs
MaksJavaGradle
/
Main.java
Copy path
File metadata and controls
55 lines (48 loc) · 1.18 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
// Main.java
// Declare the Main class
public
class
Main
{
// Main method, the entry point of the program
public
static
void
main
(
String
[]
args
) {
// Create an array of integers
int
[]
arr
= {
9
,
5
,
2
,
8
,
0
,
3
,
1
,
6
};
// Create an instance of QuickSort and use it to sort the array in descending order
Sortable
quickSort
=
new
QuickSort
();
quickSort
.
sort
(
arr
);
// Print the sorted array using Quick Sort
System
.
out
.
print
(
"Quick Sort (Descending Order): "
);
printArray
(
arr
);
// Create another array of integers
int
[]
arr2
= {
9
,
5
,
2
,
8
,
0
,
3
,
1
,
6
};
// Create an instance of MergeSort and use it to sort the second array in descending order
Sortable
mergeSort
=
new
MergeSort
();
mergeSort
.
sort
(
arr2
);
// Print the sorted array using Merge Sort
System
.
out
.
print
(
"Merge Sort (Descending Order): "
);
printArray
(
arr2
);
}
// Helper method to print an array of integers
private
static
void
printArray
(
int
[]
arr
) {
for
(
int
num
:
arr
) {
System
.
out
.
print
(
num
+
" "
);
}
System
.
out
.
println
();
}
}
Back
|
FazBrowse Home
|
New Git URL