Pengurutan Data

Judul          :  algoritma untuk mengurutkan data ascending dan descending

Spesifikasi : { mengurutkan data secara ascending dan descendingl, jumlah data dan data nya  dimasukkan dari  keyboard. Menampilkan hasil sebelum dan sesudah di sorting ke layar monitor}

Deklarasi (kamus) :

i, j, data[] = null, tmp = 0, max:int

Diskripsi :

Read(“masukkan jumlah angka”, max)

for i=0 to max do

Read (“masukkan kan data ” , data[i])

then

for  i =1 to <data.length do

for j=i to j<data.length do

if (data[i-1] < data[j]) then

tmp = data[i-1];

data[i-1] = data[j];

data[j] = tmp;

end if

end for

end for

for  i =1 to <data.length do

Write(“descending”, data[i])

for  i =1 to <data.length do

for j=i to j<data.length do

if (data[i-1] > data[j]) then

tmp = data[i-1];

data[i-1] = data[j];

data[j] = tmp;

end if

end for

end for

for  i =1 to <data.length do

Write(“ascending”, data[i])

End for

========================================================================

Program untuk mengurutkan data (ascending dan descending) menggunakan Bubble sort

About Sheilla Rizkia Ferianty

Semangat!

Posted on 03/12/2011, in Java and tagged , , , , , , , , , , , , , , , . Bookmark the permalink. 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: