Posted in May 30, 2009 ¬ 11:05 amh.cuplis
hitung jumlah simpul :
Q = FIRST;
Jum = 1;
while (Q != LAST)
{ Q = Q->LINK;
Jum = Jum + 1;
}
printf("%i", JUM);
atau
Q = FIRST;
Jum = 1;
while (Q->LINK != NULL)
{ Q = Q->LINK;
Jum = Jum + 1;
}
printf("%i", JUM);
atau
Q = FIRST;
Jum = 0;
while (Q [...]
Read the rest of this entry »
Posted in May 30, 2009 ¬ 10:23 amh.cuplis
ciri2 double ended queue :
kosong : L = R + 1
penuh kanan : R = n – 1
penuh kiri : L = 0
penuh kanan dan kiri : R = n – 1 && L = 0
bisa diisi dari kanan : R < n
bisa diisi dari kiri : L > 0
ada isinya : L < R [...]
Read the rest of this entry »
Posted in May 30, 2009 ¬ 9:43 amh.cuplis
ciri2 circular queue :
kosong : counter = 0
penuh : counter = n
bisa diisi : counter < n
ada isinya : counter > 0
kondisi awal :
f = 0;
r = -1;
counter = 0;
algoritma dasar circular queue :
INSERT
R = (R+1) % n;
Q[R] = X;
Counter++;
DELETE
X = Q[F];
[...]
Read the rest of this entry »
Posted in May 30, 2009 ¬ 9:00 amh.cuplis
ciri2 double stack :
stack 1 kosong : top1 = -1
stack 2 kosong : top2 = n
stack penuh (stack 1 dan stack 2 tidak bisa diisi) : top2 – top1 = 1
stack bisa diisi (stack 1 dan stack 2 tidak bisa diisi) : top2 – top1 > 1
stack 1 ada isinya : top1 > -1
stack 2 [...]
Read the rest of this entry »
Posted in May 30, 2009 ¬ 8:06 amh.cuplis
ciri2 single stack :
kosong : top = -1
penuh : top = n-1
bisa diisi : top < n-1
ada isinya : top > -1
kondisi awal :
top1 = -1;
algoritma dasar single stack :
PUSH
top = top + 1;
s[top] = x;
POP
x = s[top];
top = top – 1;
Bookmarks:
Read the rest of this entry »
Posted in May 27, 2009 ¬ 11:29 pmh.cuplis
kali ini coba plugin syntax highlighter and code prettifier :
java :
public class Hello {
public static void main(String[] args) {
System.out.println(“Hello World!”);
}
}
ruby :
class Example
def example(arg1)
return “Hello: ” + arg1.to_s
end
end
hasilnya sama saja. code php tetep gagal tampil.
Bookmarks:
Read the rest of this entry »