You are on page 1of 2

Nama : Refsus Saefudin

NPM : 50407697

Kelas : 4IA12

Mata Kuliah : Algoritma Pemrograman Paralel

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

Diketahui : {11, 3, 17, 20, 19, 14, 8}

Soal : Lakukan sorting dengan

 Odd- Even Transposition


 CRCW

Jawab :

 Odd-Even Transposition
n = [S] = 7
n/2 = 3.5 = 4

P1 P2 P3 P4 P5 P6 P7
11 3 17 20 19 14 8
(1) 3 11 17 20 14 19 8
(2) 3 11 17 14 20 8 19
(1) 3 11 14 17 8 20 19
(2) 3 11 14 8 17 19 20
(1) 3 11 8 14 17 19 20
(2) 3 8 11 14 17 19 20
(1) 3 8 11 14 17 19 20
(2) 3 8 11 14 17 19 20

 CRCW Sorting
S P(1,1) P(1,2) P(1,3) P(1,4) P(1,5) P(1,6) P(1,7) C S
11 (11,11) (11,3) (11,17) (11,20) (11,19) (11,14) (11,8)
0 1 0 0 0 0 1 2 3

P(2,1) P(2,2) P(2,3) P(2,4) P(2,5) P(2,6) P(2,7)


3 (3,11) (3,3) (3,17) (3,20) (3,19) (3,14) (3,8)
0 0 0 0 0 0 0 0 8

P(3,1) P(3,2) P(3,3) P(3,4) P(3,5) P(3,6) P(3,7)


17 (17,11) (17,3) (17,17) (17,20) (17,19) (17,14) (17,8)
4 11
1 1 0 0 0 1 1

P(4,1) P(4,2) P(4,3) P(4,4) P(4,5) P(4,6) P(4,7)


20 (20,11) (20,3) (20,17) (20,20) (20,19) (20,14) (20,8)
6 14
1 1 1 0 1 1 1

P(5,1) P(5,2) P(5,3) P(5,4) P(5,5) P(5,6) P(5,7)


19 (19,11) (19,3) (19,17) (19,20) (19,19) (19,14) (19,8)
1 1 1 0 0 1 1 5 17

P(6,1) P(6,2) P(6,3) P(6,4) P(6,5) P(6,6) P(6,7)


14 (14,11) (14,3) (14,17) (14,20) (14,19) (14,14) (14,8)
1 1 0 0 0 0 1 3 19

P(7,1) P(7,2) P(7,3) P(7,4) P(7,5) P(7,6) P(7,7)


8 (8,11) (8,3) (8,17) (8,20) (8,19) (8,14) (8,8)
0 1 0 0 0 0 0 1 20

You might also like