TUGAS PROYEK ALGORITMA PEMROGAMAN | IMPLEMENTASI ALGORITMA SORT DAN SEARCH - HASIL UJI COBA PROGRAM C++
Tim 03A :
1.
[2000018003] Rijki Gustiansyah
2.
[2000018027] Arya Prio Winoto
3.
[2000018048] Muhammad Ichwanul Muslim
Algoritma Insertion Sort :
procedure
insertionSort(input/output data : larik; input n : integer) |
Deklarasi : i,j,key
: integer |
Deskripsi : for
i<-to n do key
<-data[i] j<-i-1 while
((j>+0)and(data[j]>key))do data[j+1]<-data[j] j<-j-1 endwhile data[j+1]<-key endfor |
Hasil Uji Coba Insertion Sort :
Algoritma Binary Search :
function
BinarySearch(input data : larik; key : integer;) : integer |
Deklarasi : A[20],
a, b, c, i, j, n = integer temp,
key = integer find = bool |
Deskripsi : read(n) for
i<- to n do A[i]<-n endfor for
i<-0 to n do for j<-
to n do if(A[i]>A[j+1]) temp<-A[j] A[j]<-A[j+1] A[j+1]<-temp endif endfor endfor read(key) b<-0 a<-n-1 while(b
<= a)do c<-(b+a)/2 if (key = A[c]then find<-true else if (key<A[c] then a<-
c-1 else them b<-
c+1 endif endwhile
if
(find=true)then write("Nomor Antrian") else
then write("Nomor Antrian") endif |
Hasil Uji Coba Binary
Search :
Komentar
Posting Komentar