Skip to content

Unit Sorting

October 4, 2008

unit sort;
interface
uses crt;
type
larik = array [1..100] of integer;
var
i,j,n,y:byte;
copyL,l : larik;
procedure tukar(var a,b:integer);
procedure bubble_asc(var l:larik; n:byte);
procedure bubble_dsc(var l:larik; n:byte);
procedure select_min_asc(var l:larik; n:byte);
procedure select_min_dsc(var l:larik; n:byte);
procedure select_max_asc(var l:larik; n:byte);
procedure select_max_dsc(var l:larik; n:byte);
procedure insert_asc(var l:larik; n:byte);
procedure insert_dsc(var l:larik; n:byte);
procedure anim(var jml:byte);

implementation
procedure tukar(var a,b:integer);
var temp: integer;
begin
temp:=a;
a:=b;
b:=temp;
end;
procedure bubble_asc(var l:larik; n:byte);
begin
for i:=1 to n do
for j:=n downto i+1 do
if l[j] < l[j-1] then
begin
tukar(l[j],l[j-1])
end;
end;
procedure bubble_dsc(var l:larik; n:byte);
begin
for i:=1 to n do
for j:=n downto i+1 do
if l[j] > l[j-1] then
begin
tukar(l[j],l[j-1])
end;
end;

Pada unit ini akan terdapat prosedur – prosedur pengurutan data (sorting) dari ASC dan DESC. Juga terdapat prosedur untuk membuat animasi menu pada pascal. Keren kan….

Download source code dan *.TPU nya di sini.

Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: