Deskripsi untuk soal nomor 30 - 31
type arr= array of integer; var slark : array [0 .. 10] of integer = (26, 12, 10, 17, 20, 14, 44, 35, 5, 24, 33); centaur : integer = 5; function kwekkwok (slark: arr; left,right: integer): integer; var i,j,tmp,pivot:integer; begin i:= left; j:=right; pivot:=slark[(left+right) div 2]; while (i <= j) do begin while (slark[i]<pivot) do i:=i+1; while (slark[j]>pivot) do j:=j-1; if (i<=j) then begin tmp:=slark[i]; slark[i]:=slark[j]; slark[j]:=tmp; i:=i+1; j:=j-1; end; end; if (slark[centaur]=pivot) then begin kwekkwok:=pivot; end else if ((left<j) and (centaur>=left) and (centaur<=j)) then begin kwekkwok:=kwekkwok(slark, left, j); end else if ((i<right) and (centaur>=i) and (centaur<=right)) then kwekkwok:=kwekkwok(slark, i, right); end;
Berapa hasil yang dikembalikan jika dijalankan fungsi kwekkwok(slark, 0, 10)?
a. 5
b. 12
c. 17
d. 20
e. 44
Ada berapa kali pemanggilan fungsi kwekkwok pada soal nomor 31?
a. 4
b. 6
c. 8
d. 10
e. 11