TEMA WOLEH PILIH SALAH SATU :
1. KOMUNIKASI DATA
2. JARINGAN KOMPUTER
3. HARDWARE & SOFTWARE
-> MINIMAL 20 HALAMAN
-> DIPRINT DAN DIJILID PADA KERTAS A4/KUARTO
-> MAKSIMAL 2 ORANG 1 MAKALAH
DIKUMPULKAN PALING LAMBAT TGL. 7 JULI 2010
SELAMAT MENGERJAKAN...!!!!!!!!!
UPS.........
JANGAN LUPA MINGGU DEPAN 30-JUNI-2010 QUIZ KOMDAT...
-
-
Jumat, 25 Juni 2010
Senin, 21 Juni 2010
PR PROGRAM PASCAL(SORTING)
{Program Buble Sort}
uses crt;
var i,j,k,temp,n :integer;
a,b,c :array[1..100] of integer;
begin
clrscr; textcolor(12);
write('Banyaknya elemen Array : ');readln(n);
{input data}
for i:=1 to n do a[i]:=random(1000);
{cetak array sebelum urut}
writeln;textcolor(15);write('Sebelum diurutkan: ');
for i:=1 to n do write (a[i],' ');
writeln;
textcolor(15);writeln('process pengurutan bubble : ');
for i:=1 to n-1 do begin
for j:=n downto i+1 do begin
if a[j-1]>a[j] then begin
temp:=a[j-1]; a[j-1]:=a[j]; a[j]:=temp;
End;
end;
{cetak array tiap langkah pengurutan}
writeln;write('hasil akhir langkah ke - ',i,' : ');
for k:=1 to n do write(a[k],' ');
end;
{cetak array setelah pengurutan}
writeln;writeln;
textcolor(15);write('hasil pengurutan bubble : ');
for i:=1 to n do write (a[i],' ');
readln;
end.
=======================================================
{Program Sort Gravitasi)
uses crt;
var i,j,k,temp,n :integer;
a,b,c :array[1..100] of integer;
begin
clrscr; textcolor(12);
write('Banyaknya elemen Array : ');readln(n);
{input data}
for i:=1 to n do begin
write('elemen ke - ',i,' ');readln(a[i]);
end;
{cetak array sebelum urut}
writeln;textcolor(15);write('Sebelum diurutkan: ');
for i:=1 to n do
write(a[i],' ');
writeln;
textcolor(15);
writeln;;writeln('process pengurutan Gravitasi : ');
for i:=1 to n-1 do begin
for j:=1 to n-i do begin
if a[j]>a[j+1] then begin
temp:=a[j+1];
a[j+1]:=a[j];
a[j]:=temp;
end;
end;
writeln; textcolor(i);
{cetak array tiap langkah pengurutan}
write('hasil akhir langkah ke - ',i,' : ');
for k:=1 to n do write(a[k],' ');
end;
{cetak array setelah pengurutan}
writeln;writeln;
textcolor(15);write('hasil pengurutan Gravitasi : ');
for i:=1 to n do
write (a[i],' ');
writeln;writeln;textcolor(10);
write('sudah terurut dengan benar khan..?');
readln;
end.
===========================================
{Program Sort Seleksi}
uses crt;
var i,j,k,temp,imax,n :integer;
a,b,c :array[1..100] of integer;
begin
clrscr; textcolor(12);
write('Banyaknya elemen Array : ');readln(n);
{input data}
for i:=1 to n do begin
write('elemen ke - ',i,' ');readln(a[i]);
end;
{cetak array sebelum urut}
writeln;textcolor(15);write('Sebelum diurutkan: ');
for i:=1 to n do
write(a[i],' ');
writeln;writeln;
textcolor(15);
Writeln;;writeln('process pengurutan Seleksi : ');
for i:=1 to n-1 do begin
imax:=i;
for j:=i+1 to n do
if a[j]
{tukar a[j] dengan a[imax]}
temp:=a[imax];a[imax]:=a[i];a[i]:=temp;
writeln;textcolor(i);
{cetak array tiap langkah pengurutan}
write('hasil akhir langkah ke - ',i,' : ');
for k:=1 to n do write(a[k],' ');
end;
{cetak array setelah pengurutan}
writeln;writeln;
textcolor(15);write('hasil pengurutan Seleksi : ');
for i:=1 to n do
write (a[i],' ');
readln;
end.
==============================================
{Program Sort Insertion}
uses crt;
var i,j,k,temp,imax,n :integer;
a,b,c :array[1..100] of integer;
begin
clrscr; textcolor(12);
write('Banyaknya elemen Array : ');readln(n);
{input data}
for i:=1 to n do begin
write('elemen ke - ',i,' ');readln(a[i]);
end;
{cetak array sebelum urut}
writeln;textcolor(15);write('Sebelum diurutkan: ');
for i:=1 to n do
write(a[i],' ');
writeln;
textcolor(15);
writeln;writeln('process pengurutan Insertion : ');
for i:=2 to n do begin
temp:=a[i];j:=i-1;
while (temp0) do j:=J-1;
for k:=i downto j+1 do a[k]:=a[k-1];
a[j+1]:=temp;
writeln;textcolor(i);
{cetak array tiap langkah pengurutan}
write('hasil akhir langkah ke - ',i-1,' : ');
for k:=1 to n do write(a[k],' ');
end;
{SETAK SETELAH PENGURUTAN}
writeln;writeln;
textcolor(15);write('hasil pengurutan INSERTION : ');
for i:=1 to n do
write (a[i],' ');
readln;
end.
=================================================
{Program Sort Insertion}
Uses crt;
var i,j,k,temp,imax,n :integer;
a,b,c :array[1..100] of integer;
begin
clrscr; textcolor(12);
write('Banyaknya elemen Array : ');readln(n);
{input data}
for i:=1 to n do begin
write('elemen ke - ',i,' ');readln(a[i]);
end;
{cetak array sebelum urut}
writeln;textcolor(15);write('Sebelum diurutkan: ');
for i:=1 to n do
write(a[i],' ');
writeln;
textcolor(15);
writeln;writeln('process pengurutan Swap Insertion : ');
for i:=1 to n-1 do begin
j:=i+1;
while (a[j]1) do begin
temp:=a[j-1];
a[j-1]:=a[j];
a[j]:=temp;
j:=j-1;
end;
writeln;textcolor(i);
{cetak array tiap langkah pengurutan}
write('hasil akhir langkah ke - ',i,' : ');
for k:=1 to n do write(a[k],' ');
end;
{SETAK SETELAH PENGURUTAN}
writeln;writeln;
textcolor(15);write('hasil pengurutan SWAP-INSERTION : ');
for i:=1 to n do
write (a[i],' ');
readln;
end.
uses crt;
var i,j,k,temp,n :integer;
a,b,c :array[1..100] of integer;
begin
clrscr; textcolor(12);
write('Banyaknya elemen Array : ');readln(n);
{input data}
for i:=1 to n do a[i]:=random(1000);
{cetak array sebelum urut}
writeln;textcolor(15);write('Sebelum diurutkan: ');
for i:=1 to n do write (a[i],' ');
writeln;
textcolor(15);writeln('process pengurutan bubble : ');
for i:=1 to n-1 do begin
for j:=n downto i+1 do begin
if a[j-1]>a[j] then begin
temp:=a[j-1]; a[j-1]:=a[j]; a[j]:=temp;
End;
end;
{cetak array tiap langkah pengurutan}
writeln;write('hasil akhir langkah ke - ',i,' : ');
for k:=1 to n do write(a[k],' ');
end;
{cetak array setelah pengurutan}
writeln;writeln;
textcolor(15);write('hasil pengurutan bubble : ');
for i:=1 to n do write (a[i],' ');
readln;
end.
=======================================================
{Program Sort Gravitasi)
uses crt;
var i,j,k,temp,n :integer;
a,b,c :array[1..100] of integer;
begin
clrscr; textcolor(12);
write('Banyaknya elemen Array : ');readln(n);
{input data}
for i:=1 to n do begin
write('elemen ke - ',i,' ');readln(a[i]);
end;
{cetak array sebelum urut}
writeln;textcolor(15);write('Sebelum diurutkan: ');
for i:=1 to n do
write(a[i],' ');
writeln;
textcolor(15);
writeln;;writeln('process pengurutan Gravitasi : ');
for i:=1 to n-1 do begin
for j:=1 to n-i do begin
if a[j]>a[j+1] then begin
temp:=a[j+1];
a[j+1]:=a[j];
a[j]:=temp;
end;
end;
writeln; textcolor(i);
{cetak array tiap langkah pengurutan}
write('hasil akhir langkah ke - ',i,' : ');
for k:=1 to n do write(a[k],' ');
end;
{cetak array setelah pengurutan}
writeln;writeln;
textcolor(15);write('hasil pengurutan Gravitasi : ');
for i:=1 to n do
write (a[i],' ');
writeln;writeln;textcolor(10);
write('sudah terurut dengan benar khan..?');
readln;
end.
===========================================
{Program Sort Seleksi}
uses crt;
var i,j,k,temp,imax,n :integer;
a,b,c :array[1..100] of integer;
begin
clrscr; textcolor(12);
write('Banyaknya elemen Array : ');readln(n);
{input data}
for i:=1 to n do begin
write('elemen ke - ',i,' ');readln(a[i]);
end;
{cetak array sebelum urut}
writeln;textcolor(15);write('Sebelum diurutkan: ');
for i:=1 to n do
write(a[i],' ');
writeln;writeln;
textcolor(15);
Writeln;;writeln('process pengurutan Seleksi : ');
for i:=1 to n-1 do begin
imax:=i;
for j:=i+1 to n do
if a[j]
{tukar a[j] dengan a[imax]}
temp:=a[imax];a[imax]:=a[i];a[i]:=temp;
writeln;textcolor(i);
{cetak array tiap langkah pengurutan}
write('hasil akhir langkah ke - ',i,' : ');
for k:=1 to n do write(a[k],' ');
end;
{cetak array setelah pengurutan}
writeln;writeln;
textcolor(15);write('hasil pengurutan Seleksi : ');
for i:=1 to n do
write (a[i],' ');
readln;
end.
==============================================
{Program Sort Insertion}
uses crt;
var i,j,k,temp,imax,n :integer;
a,b,c :array[1..100] of integer;
begin
clrscr; textcolor(12);
write('Banyaknya elemen Array : ');readln(n);
{input data}
for i:=1 to n do begin
write('elemen ke - ',i,' ');readln(a[i]);
end;
{cetak array sebelum urut}
writeln;textcolor(15);write('Sebelum diurutkan: ');
for i:=1 to n do
write(a[i],' ');
writeln;
textcolor(15);
writeln;writeln('process pengurutan Insertion : ');
for i:=2 to n do begin
temp:=a[i];j:=i-1;
while (temp0) do j:=J-1;
for k:=i downto j+1 do a[k]:=a[k-1];
a[j+1]:=temp;
writeln;textcolor(i);
{cetak array tiap langkah pengurutan}
write('hasil akhir langkah ke - ',i-1,' : ');
for k:=1 to n do write(a[k],' ');
end;
{SETAK SETELAH PENGURUTAN}
writeln;writeln;
textcolor(15);write('hasil pengurutan INSERTION : ');
for i:=1 to n do
write (a[i],' ');
readln;
end.
=================================================
{Program Sort Insertion}
Uses crt;
var i,j,k,temp,imax,n :integer;
a,b,c :array[1..100] of integer;
begin
clrscr; textcolor(12);
write('Banyaknya elemen Array : ');readln(n);
{input data}
for i:=1 to n do begin
write('elemen ke - ',i,' ');readln(a[i]);
end;
{cetak array sebelum urut}
writeln;textcolor(15);write('Sebelum diurutkan: ');
for i:=1 to n do
write(a[i],' ');
writeln;
textcolor(15);
writeln;writeln('process pengurutan Swap Insertion : ');
for i:=1 to n-1 do begin
j:=i+1;
while (a[j]1) do begin
temp:=a[j-1];
a[j-1]:=a[j];
a[j]:=temp;
j:=j-1;
end;
writeln;textcolor(i);
{cetak array tiap langkah pengurutan}
write('hasil akhir langkah ke - ',i,' : ');
for k:=1 to n do write(a[k],' ');
end;
{SETAK SETELAH PENGURUTAN}
writeln;writeln;
textcolor(15);write('hasil pengurutan SWAP-INSERTION : ');
for i:=1 to n do
write (a[i],' ');
readln;
end.
Langganan:
Postingan (Atom)