Thursday, March 17, 2016

ALPRO || Pertemuan ke 8 :: Reversal


misal:
n=7
A[i] ==> A[1]=1, A[2]=2, A[3]=3, A[4]=4, A[5]=5, A[6]=6, A[7]=7

sebelum reversal



1
2
3
4
5
6
7


merubah menjadi reversal ::
rumus  n - i +1
7 - 1 + 1 = 7
7 - 2 + 1 = 6
7 - 3 + 1 = 5
7 - 4 + 1 = 4
7 - 5 + 1 = 3
7 - 6 + 1 = 2
7 - 7 + 1 = 1

sesudah reversal









7
6
5
4
3
2
1











Load disqus comments

0 komentar