Assalammu'alaikum Warahmatullahi Wabarokatuh
Buatlah Tabel yang menunjukkan hasil
komputasi algoritma Prefix Sum(1) bila diberikan input:
a[0,1,2,3,...,9] =
{4,3,8,2,9,1,0,5,6,3}.
|
Po
|
Pi
|
P5
|
P4
|
P6
|
P-
|
Pa
|
Ps
|
|||
4
|
3
|
8
|
2
|
9
|
1
|
0
|
5
|
6
|
3
|
|
k=0
|
0 - 2°< 0
|
1 - 2°== 0;
A[l]=3;
A[ 1-2°]=4 A[i]=3+4
|
2 - 2° > 0
A[2]=8:
A[2—2°]=3 A[i]=8+3
|
3 - 2° > 0
A[3]=2;
A[3—2°]=8 A[i]=2+8
|
4 - 2 °> 0
A[4]=9:
A[4-2°]=2
A[i]=9+2
|
5 -2°> 0
A[5]=l;
A[5-2=°]=9
A[i]=l+9
|
6 - 2°> 0
A[6]=0;
A[6-2°]=l
A[i]=0+1
|
7 - 2° > 0
A[7]=5;
A[7-2°]=0
A[i]=5+0
|
8 - 2° > 0
A[8]=6;
A[8-2°]=5
A[i]=6+5
|
9 - 2° > 0
A[9]=3:
A[9-2°]=6
A[i]=3+6
|
A[0] =4
|
A[l]=7
|
A[2]=l 1
|
A[3]=10
|
A[4]=l 1
|
A[5]=10
|
A[6]=l
|
A[7]=5
|
A[8]=l 1
|
A[9]=9
|
|
k=l
|
0 - 21 < 0
|
1 -21<0 span="">0>
|
2 - 21 = 0
A[2]=l1;
A[2-21]=4
A[i]=11+4
|
3 - 21 > 0
A[3]=10;
A[3—21]=7 A[i]=l0+7
|
4 - 21 > 0
A[4]=11; A[4-21]=11 A[i]=l1+11
|
5 - 21 > 0
A[5]=10;
A[5-21]=10
A[i]=l0+10
|
6 - 21 > 0
A[6]=l; A[6-21]=l1 A[i]=l+11
|
7 - 21 > 0
A[7]=5;
A[7-21]=10
A[i]=5-10
|
8 - 21 > 0
A[8]=l 1;
A[8-21]=1
A[i]=ll+1
|
9 - 21 > 0
A[9]=9:
A[9-21]=5
A[i]=9-5
|
A[0] =4
|
A[ 1 ]=7
|
A[2]= 15
|
A[3]=17
|
A[4]=22
|
A[5]=20
|
A[6]=l 2
|
A[7]=15
|
A[8]=12
|
A[9]=14
|
|
k=2
|
0 - 22 < 0
|
1 -22<0 span="">0>
|
2 - 22 < 0
|
3 - 22 < 0
|
4 - 22 = 0
A[4]=22-
A[4-22]=4
A[i]=22+4
|
5-22>0
A[5]=20;
A[5-22]=7
A[i]=20+7
|
6-22>0
A[6]=12:
A[6-22]=15 A[i]=12-15
|
7 - 22 > 0
A[7]=l 5;
A[7-22]=17 A[i]=15+17
|
8 - 22 > 0
A[8]=12;
A[8-22]=22 A[i]=12+22
|
9 - 22 > 0
A[9]=14;
A[9-22]=20 A[i]=14+20
|
A[0] =4
|
A[ 1 ]=7
|
A[2]=15
|
A[3]=17
|
A[4]=26
|
A[5]=27
|
A[6]=27
|
A[7]=32
|
A[8]=34
|
A[9]=34
|
|
K=3
|
0 - 23 < 0
|
1 -23<0 span="">0>
|
2 - 23 < 0
|
3 - 23 < 0
|
4 -23< 0
|
5 - 23< 0
|
6 -23< 0
|
7 - 23= > 0
|
8 - 23 = 0
A[8]=34;
A[8-23]=4
A[i]=34+4
|
9 - 23 > 0
A[9]=34;
A[9-2J]=7
A[i]=34+7
|
A[0] =4
|
A[l]=7
|
A[2]=15
|
A[3]=L7
|
A[4]=26
|
A[5]=27
|
A[6]=27
|
A[7]=32
|
A[8]=38
|
A[9]=41
|
Tidak ada komentar:
Posting Komentar