/**
* @param args the command line arguments
*/
public static void main(String[] args) {
String matrik1[]={"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 matrik3[]={"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 input = JOptionPane.showInputDialog(null, "Masukkan sandi anda").toUpperCase();
char x[] = input.toCharArray();
for (int i = 0; i < x.length; i++) {
for (int j = 0; j < matrik3.length; j++) {
if(String.valueOf(x[i]).equalsIgnoreCase(matrik3[j])) {
System.out.print(matrik1[j]);
} }}}}
Perhitungan :
i = 0 dieksekusi 1 kali
i<n.lenght dieksekusi n kali
i++ dieksekusi n kali
j = 0 dieksekusi 1 kali
j<sandi.lenght dieksekusi n x n kali
j++ dieksekusi n x n kali
terjemahan [] dieksekusi 1 kali
sandi [] dieksekusi 1 kali
if dieksekusi 1 kali
4 + 2n + 2n2 = T(n) = O(n2)
Posted by 21.04 and have
0
komentar
, Published at
Tidak ada komentar:
Posting Komentar