public
class UTS2 {
*/
public static void main(String[] args) {
String
[]aa
={"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","
"};
String
[] sd={"10","20","30","40","50","60","70","80","90","00","11","21","31",
"41","51","61","71","81","91","01","12","22","32","42","52","62","72"};
String
kode = JOptionPane.showInputDialog(null, "Masukkan sandi anda");
char
[] c = kode.toCharArray();
for
(int i = 0; i < c.length; i++) {
for (int j = 0; j < aa.length; j++) {
if(String.valueOf(c[i]).equalsIgnoreCase(aa[j]))
//equals
System.out.print(sd[j]);
}
}
System.out.println("");
}
}
RUNNING
TIME
- String [] aa // sesuai dg jumla
array 27
x
- String [] sd // sesuai dg jumla
array 27
x
- String kode =
JOptionPane.showInputDialog(null, "Masukkan sandi anda"); n x
- int i = 0; 1
x
- i < c.length; n
x
- i++ n
x
- int j = 0; 1
x
- j < aa.length; n
x n
- j++ n
x n
- if(String.valueOf(c[i]).equalsIgnoreCase(aa[j])) n
x n +
56 + 3n + 3n2 kali = T(n) = O ( n3 )
Nama : Muhamad Risqi
N.I.M : 2012420100
Posted by 22.22 and have
0
komentar
, Published at
Tidak ada komentar:
Posting Komentar