String sandi1 [ ]={"a","b","c","d","e","f","g","h","i","j","k",
"l","m","n","o","p","q","r","s","t","u","v",
"w","x","y","z","0","1","2","3","4","5","6",
"7","8","9"," "};
String sandi2 [ ]={"G","K","M","W","Q","Y","X","Z","N","O","P",
"A","R","U","T","V","Z","H","J","L","B","C",
"D","E","F","I","7","5","3","2","6","8","9",
"4","0","1","*"};
String kode = JOptionPane.showInputDialog(null,
"Masukkan sandi anda");
char a[ ] = kode.toCharArray();
for (int i = 0; i < a.length; i++) {
for (int j = 0; j < sandi2.length;
j++) {
if(String.valueOf(a[i]).equalsIgnoreCase(sandi2[j]))//equals
JOptionPane.showMessageDialog(null,"Terjemahan
Sandi: "+sandi1[j]);
Perhitungan eksekusi:
Sandi1 [ ] dieksekusi 1 x 37 kali
Sandi2 [ ] dieksekusi 1 x 37 kali
i = 0 dieksekusi
1 kali
i + + dieksekusi
n kali
i < a.length dieksekusi
n kali
j = 0 dieksekusi
1 kali
j < sandi2.length dieksekusi n
x n kali
j + + dieksekusi n
x n kali
if dieksekusi
1 kali +
77+2n+2(n2)->T(n) = O(n2)
Nama: Ria Suryani
NIM: 2012420033
Kelas: A
Posted by 01.45 and have
0
komentar
, Published at
Tidak ada komentar:
Posting Komentar