-
Notifications
You must be signed in to change notification settings - Fork 0
/
eval3.1.html
140 lines (135 loc) · 6.99 KB
/
eval3.1.html
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Evaluasi 3.1</title>
<style>
body {
font-family: Arial, sans-serif;
background-color: blue;
margin: 0;
padding: 0;
}
.container {
max-width: 800px;
margin: 20px auto;
padding: 20px;
background-color: #fff;
border-radius: 5px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}
h1 {
text-align: center;
color: #333;
}
.code {
margin-bottom: 20px;
padding: 10px;
border-left: 5px solid #007bff;
background-color: #f8f9fa;
color: #333;
overflow-x: auto;
}
.ButtonStyle {
text-align: center;
margin-top: 20px;
}
.styled {
border: 0;
line-height: 2.5;
padding: 0 20px;
font-size: 1rem;
text-align: center;
color: #fff;
text-shadow: 1px 1px 1px #000;
border-radius: 10px;
background-color: rgb(52, 35, 6);
background-image: linear-gradient(
to top left,
rgba(0, 0, 0, 0.2),
rgba(0, 0, 0, 0.2) 30%,
rgba(0, 0, 0, 0)
);
box-shadow:
inset 2px 2px 3px rgba(255, 255, 255, 0.6),
inset -2px -2px 3px rgba(0, 0, 0, 0.6);
}
.styled:hover {
background-color: rgb(84, 60, 10);
}
.styled:active {
box-shadow:
inset -2px -2px 3px rgba(255, 255, 255, 0.6),
inset 2px 2px 3px rgba(0, 0, 0, 0.6);
}
.code pre {
margin: 0;
padding: 0;
white-space: pre-wrap;
tab-size: 4;
}
</style>
</head>
<body>
<div class="container">
<h1>Insert Sorting</h1>
<div class="code">
<pre><code> using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace _3._1_Insert_Sorting
{
internal class Program
{
// Fungsi untuk melakukan Insertion Sort
static void InsertSort(int[] array)
{
int nilai = array.Length;
for (int i = 1; i < nilai; ++i)
{
int kunci = array[i];
int j = i - 1;
// Pindahkan elemen dari arr[0..i-1], yang lebih besar dari key, ke satu posisi di depan posisi mereka saat ini
while (j >= 0 && array[j] > kunci)
{
array[j + 1] = array[j];
j = j - 1;
}
array[j + 1] = kunci;
}
}
// Fungsi untuk mencetak array
static void MenampilkanArray(int[] array)
{
foreach (int angka in array)
{
Console.Write(angka + " ");
}
Console.WriteLine();
}
static void Main(string[] args)
{
// Definisikan array contoh
int[] array = { 12, 11, 13, 5, 6 };
Console.WriteLine("Array sebelum pengurutan:");
MenampilkanArray(array);
// Lakukan Insertion Sort
InsertSort(array);
Console.WriteLine("\nArray setelah pengurutan:");
MenampilkanArray(array);
}
}
}
</code></pre>
</div>
</div>
<div class="ButtonStyle">
<button class="favorite styled" onclick="window.location.href='kesimpulan.html'" type="button">Previous</button>
<button class="favorite styled" onclick="window.location.href='index.html'" type="button">Home</button>
<button class="favorite styled" onclick="window.location.href='eval3.2.html'" type="button">Next</button>
</div>
</body>
</html>