Sei sulla pagina 1di 7

TB 1 DESAIN DAN ANALISIS ALGORITMA

KELAS: H

Oleh :
Kelompok
Nama

NIM

WISNU KURNIADI EKO W

135150207111090

PANGESTU ARI WIJAYA

135150201111077

MURIA NAHARUL HUDAN N U

135150219111001

RIO CAHYO ANGGONO

135150201111133

I PUTU KRISNA YOGA TANAYA 145150201111109

Dosen Pengampu: Ratih Kartika Dewi, S.T, M.Kom.

PROGRAM TEKNOLOGI INFORMASI DAN ILMU KOMPUTER


UNIVERSITAS BRAWIJAYA
2014

1. Review Paper

Data Jurnal
o Judul Jurnal

: Brute Force Password Generation- Basic

Iterative and Recursive Algorithm.


o Nama pengarang

: Nick V. Flor, Haile Shannon

o Nama jurnal

: Recursive Algorithms

o Masalah yang diselesaikan

2. Algoritma
algoritma :

alur & cara kerja algoritma :

3. Implementasi

Source code
IterativePassword.java
package iterative;
import java.util.Scanner;
/**
*
* @author samsung
*/
public class iterativePassword {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
double tryTimes=1;
String password;
char[] chars = { '1', '2', '3', '4', '5', '6', '7', '8', '9', '0'};
System.out.println("{0} words total, Only numbers allowed");
System.out.print("Password Length? :");
int iPasswordLength = input.nextInt();
int iPossibilities = (int) Math.pow((double) chars.length, (double)
iPasswordLength);
System.out.println("\npossibilities : "+iPossibilities);
System.out.print("Password? :");
password = input.next();
System.out.println("-----------------------");
System.out.println("your password : "+password+"\nnow trying to generate"
+ " password");
for (int i = 0; i < iPossibilities; i++){
String theword = "";
int val = i;
for (int j = 0; j < iPasswordLength; j++) {
int ch = val % chars.length;
theword = chars[ch]+theword;
val = val / chars.length;
}
if(theword.equals(password)){
System.out.println("password Found!\nyour password is
"+theword);
break;
}
tryTimes++;
System.out.println(theword);
}
System.out.println("try times : "+tryTimes);
}

recursivePassword.java
package recursive;
import java.util.Scanner;
/**
*
* @author samsung

*/
public class recursivePassword {
static char[] chars={'1','2','3','4','5','6','7','8','9','0'};
static String password;
static int tryTimes=1;
static void GenerateAllPasswords(String pwd, int pos, int siz){
char ch;
if(password == null ? pwd == null : password.equals(pwd)){
System.out.println("Try "+tryTimes+" : "+pwd);
System.out.println("Password found!\nyour password is : "+pwd);
System.out.println("try times : "+tryTimes);
System.exit(0);
}
else{
if (pos < siz){
for (int i=0;i<chars.length;i++){
ch = chars[i];
tryTimes++;
GenerateAllPasswords(pwd+=ch, pos + 1, siz);
}
}
else
System.out.println("Try "+tryTimes+" : "+pwd);}
}
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.print("Password Length? : ");
int iPasswordLength = input.nextInt();
System.out.print("Password? (only numbers allowed): ");
password=input.next();
System.out.println("---------------------");
System.out.println("your password : "+password
+"\nnow generating password with recursive method");
GenerateAllPasswords("", 0, iPasswordLength);
}

Screenshoot:
Gambar 1.1 Implementasi Iterative Password Generator

Gambar 1.2 Implementasi Recursive Password Generator

4. Analisis kompleksitas
4.1 Penentuan n

4.2 Basic operation & alasan pemilihan

4.3 Proses memperoleh C(n)

Catatan Dosen Pengampu


Kelas:
Kelompok:

Pemilihan paper acuan

Review

Kompleksitas

Implementasi

Lain2

Jur
Int
Al>1
Jud+Nam
Mslh Ut
Desc Al
N
Bo
C(n)
OOG
ASYM
Cde
Scrst
Rap
Tep

Jumlah

(Ratih Kartika Dewi, S.T, M.Kom.)

Potrebbero piacerti anche