1 sorting networks. 2 10 9 4 3 2 1 8 7 9 4 3 2 1 8 7 sorting
DESCRIPTION
3 Sorting Network (Bitonic Sorting Network)TRANSCRIPT
![Page 1: 1 Sorting Networks. 2 10 9 4 3 2 1 8 7 9 4 3 2 1 8 7 Sorting](https://reader033.vdocuments.us/reader033/viewer/2022051105/5a4d1b727f8b9ab0599b59f2/html5/thumbnails/1.jpg)
1
Sorting Networks
![Page 2: 1 Sorting Networks. 2 10 9 4 3 2 1 8 7 9 4 3 2 1 8 7 Sorting](https://reader033.vdocuments.us/reader033/viewer/2022051105/5a4d1b727f8b9ab0599b59f2/html5/thumbnails/2.jpg)
2
10
94
3
21
87
109
4321
87
Sorting
![Page 3: 1 Sorting Networks. 2 10 9 4 3 2 1 8 7 9 4 3 2 1 8 7 Sorting](https://reader033.vdocuments.us/reader033/viewer/2022051105/5a4d1b727f8b9ab0599b59f2/html5/thumbnails/3.jpg)
3
Sorting Network
(Bitonic Sorting Network)
![Page 4: 1 Sorting Networks. 2 10 9 4 3 2 1 8 7 9 4 3 2 1 8 7 Sorting](https://reader033.vdocuments.us/reader033/viewer/2022051105/5a4d1b727f8b9ab0599b59f2/html5/thumbnails/4.jpg)
4
Sorting Network
(Bitonic Sorting Network)
![Page 5: 1 Sorting Networks. 2 10 9 4 3 2 1 8 7 9 4 3 2 1 8 7 Sorting](https://reader033.vdocuments.us/reader033/viewer/2022051105/5a4d1b727f8b9ab0599b59f2/html5/thumbnails/5.jpg)
5
Comparator
x
y
max(x,y)
min(x,y)
![Page 6: 1 Sorting Networks. 2 10 9 4 3 2 1 8 7 9 4 3 2 1 8 7 Sorting](https://reader033.vdocuments.us/reader033/viewer/2022051105/5a4d1b727f8b9ab0599b59f2/html5/thumbnails/6.jpg)
6
Comparatormax
min
1
9
9
1
![Page 7: 1 Sorting Networks. 2 10 9 4 3 2 1 8 7 9 4 3 2 1 8 7 Sorting](https://reader033.vdocuments.us/reader033/viewer/2022051105/5a4d1b727f8b9ab0599b59f2/html5/thumbnails/7.jpg)
7
Comparatormax
min
100
4
100
4
![Page 8: 1 Sorting Networks. 2 10 9 4 3 2 1 8 7 9 4 3 2 1 8 7 Sorting](https://reader033.vdocuments.us/reader033/viewer/2022051105/5a4d1b727f8b9ab0599b59f2/html5/thumbnails/8.jpg)
8
![Page 9: 1 Sorting Networks. 2 10 9 4 3 2 1 8 7 9 4 3 2 1 8 7 Sorting](https://reader033.vdocuments.us/reader033/viewer/2022051105/5a4d1b727f8b9ab0599b59f2/html5/thumbnails/9.jpg)
9
Levels1 2 3
Depth = 3
Width = 4
![Page 10: 1 Sorting Networks. 2 10 9 4 3 2 1 8 7 9 4 3 2 1 8 7 Sorting](https://reader033.vdocuments.us/reader033/viewer/2022051105/5a4d1b727f8b9ab0599b59f2/html5/thumbnails/10.jpg)
10
1825
![Page 11: 1 Sorting Networks. 2 10 9 4 3 2 1 8 7 9 4 3 2 1 8 7 Sorting](https://reader033.vdocuments.us/reader033/viewer/2022051105/5a4d1b727f8b9ab0599b59f2/html5/thumbnails/11.jpg)
11
18
25
Level 1
![Page 12: 1 Sorting Networks. 2 10 9 4 3 2 1 8 7 9 4 3 2 1 8 7 Sorting](https://reader033.vdocuments.us/reader033/viewer/2022051105/5a4d1b727f8b9ab0599b59f2/html5/thumbnails/12.jpg)
12
1
8
2
5
Level 2
![Page 13: 1 Sorting Networks. 2 10 9 4 3 2 1 8 7 9 4 3 2 1 8 7 Sorting](https://reader033.vdocuments.us/reader033/viewer/2022051105/5a4d1b727f8b9ab0599b59f2/html5/thumbnails/13.jpg)
13
1
8
25
Level 3
![Page 14: 1 Sorting Networks. 2 10 9 4 3 2 1 8 7 9 4 3 2 1 8 7 Sorting](https://reader033.vdocuments.us/reader033/viewer/2022051105/5a4d1b727f8b9ab0599b59f2/html5/thumbnails/14.jpg)
14
1
8
25
1825
Input Output
![Page 15: 1 Sorting Networks. 2 10 9 4 3 2 1 8 7 9 4 3 2 1 8 7 Sorting](https://reader033.vdocuments.us/reader033/viewer/2022051105/5a4d1b727f8b9ab0599b59f2/html5/thumbnails/15.jpg)
15
10
94
3
21
87
109
4321
87
Input Output
![Page 16: 1 Sorting Networks. 2 10 9 4 3 2 1 8 7 9 4 3 2 1 8 7 Sorting](https://reader033.vdocuments.us/reader033/viewer/2022051105/5a4d1b727f8b9ab0599b59f2/html5/thumbnails/16.jpg)
16
10
94
3
21
87
109
4321
87
1 2 3 4 5 6levels
![Page 17: 1 Sorting Networks. 2 10 9 4 3 2 1 8 7 9 4 3 2 1 8 7 Sorting](https://reader033.vdocuments.us/reader033/viewer/2022051105/5a4d1b727f8b9ab0599b59f2/html5/thumbnails/17.jpg)
17
Sort(n)
Sort(n/2)
Sort(n/2)
Merge(n)In Out
)(log2 nOdepth
Recursive construction of Bitonic Sorting Network
![Page 18: 1 Sorting Networks. 2 10 9 4 3 2 1 8 7 9 4 3 2 1 8 7 Sorting](https://reader033.vdocuments.us/reader033/viewer/2022051105/5a4d1b727f8b9ab0599b59f2/html5/thumbnails/18.jpg)
18
Merge(n)
Merge(n/2)
Merge(n/2)
)(lognOdepth
Recursive construction of merging network
![Page 19: 1 Sorting Networks. 2 10 9 4 3 2 1 8 7 9 4 3 2 1 8 7 Sorting](https://reader033.vdocuments.us/reader033/viewer/2022051105/5a4d1b727f8b9ab0599b59f2/html5/thumbnails/19.jpg)
19
Induction BasisSort(2)
Merge(2)
![Page 20: 1 Sorting Networks. 2 10 9 4 3 2 1 8 7 9 4 3 2 1 8 7 Sorting](https://reader033.vdocuments.us/reader033/viewer/2022051105/5a4d1b727f8b9ab0599b59f2/html5/thumbnails/20.jpg)
20
Width
Sorting network depth:
)(log2log...4log2loglog 2nOnnn
n
)(log2 nO
Mergerwidth n
Totaldepth
2n
4n 2
![Page 21: 1 Sorting Networks. 2 10 9 4 3 2 1 8 7 9 4 3 2 1 8 7 Sorting](https://reader033.vdocuments.us/reader033/viewer/2022051105/5a4d1b727f8b9ab0599b59f2/html5/thumbnails/21.jpg)
21
Counting Networks
![Page 22: 1 Sorting Networks. 2 10 9 4 3 2 1 8 7 9 4 3 2 1 8 7 Sorting](https://reader033.vdocuments.us/reader033/viewer/2022051105/5a4d1b727f8b9ab0599b59f2/html5/thumbnails/22.jpg)
22
The Counting Problem
0
Shared variable
![Page 23: 1 Sorting Networks. 2 10 9 4 3 2 1 8 7 9 4 3 2 1 8 7 Sorting](https://reader033.vdocuments.us/reader033/viewer/2022051105/5a4d1b727f8b9ab0599b59f2/html5/thumbnails/23.jpg)
23
0
Token = Increment request
Shared variable
![Page 24: 1 Sorting Networks. 2 10 9 4 3 2 1 8 7 9 4 3 2 1 8 7 Sorting](https://reader033.vdocuments.us/reader033/viewer/2022051105/5a4d1b727f8b9ab0599b59f2/html5/thumbnails/24.jpg)
24
1
Increment request
Shared variable
0
![Page 25: 1 Sorting Networks. 2 10 9 4 3 2 1 8 7 9 4 3 2 1 8 7 Sorting](https://reader033.vdocuments.us/reader033/viewer/2022051105/5a4d1b727f8b9ab0599b59f2/html5/thumbnails/25.jpg)
25
1
Shared variable
![Page 26: 1 Sorting Networks. 2 10 9 4 3 2 1 8 7 9 4 3 2 1 8 7 Sorting](https://reader033.vdocuments.us/reader033/viewer/2022051105/5a4d1b727f8b9ab0599b59f2/html5/thumbnails/26.jpg)
26
1
Increment request
Shared variable
![Page 27: 1 Sorting Networks. 2 10 9 4 3 2 1 8 7 9 4 3 2 1 8 7 Sorting](https://reader033.vdocuments.us/reader033/viewer/2022051105/5a4d1b727f8b9ab0599b59f2/html5/thumbnails/27.jpg)
27
2
Shared variable
1Increment request
![Page 28: 1 Sorting Networks. 2 10 9 4 3 2 1 8 7 9 4 3 2 1 8 7 Sorting](https://reader033.vdocuments.us/reader033/viewer/2022051105/5a4d1b727f8b9ab0599b59f2/html5/thumbnails/28.jpg)
28
2
Shared variable
![Page 29: 1 Sorting Networks. 2 10 9 4 3 2 1 8 7 9 4 3 2 1 8 7 Sorting](https://reader033.vdocuments.us/reader033/viewer/2022051105/5a4d1b727f8b9ab0599b59f2/html5/thumbnails/29.jpg)
29
2
Increment request
Shared variable
![Page 30: 1 Sorting Networks. 2 10 9 4 3 2 1 8 7 9 4 3 2 1 8 7 Sorting](https://reader033.vdocuments.us/reader033/viewer/2022051105/5a4d1b727f8b9ab0599b59f2/html5/thumbnails/30.jpg)
30
3
Increment request
Shared variable
2
![Page 31: 1 Sorting Networks. 2 10 9 4 3 2 1 8 7 9 4 3 2 1 8 7 Sorting](https://reader033.vdocuments.us/reader033/viewer/2022051105/5a4d1b727f8b9ab0599b59f2/html5/thumbnails/31.jpg)
31
6
Sequential Bottleneck
Shared variable
The requests have to be serialized
01 2 3
45
![Page 32: 1 Sorting Networks. 2 10 9 4 3 2 1 8 7 9 4 3 2 1 8 7 Sorting](https://reader033.vdocuments.us/reader033/viewer/2022051105/5a4d1b727f8b9ab0599b59f2/html5/thumbnails/32.jpg)
32
Counting Network
Inputs Outputs
![Page 33: 1 Sorting Networks. 2 10 9 4 3 2 1 8 7 9 4 3 2 1 8 7 Sorting](https://reader033.vdocuments.us/reader033/viewer/2022051105/5a4d1b727f8b9ab0599b59f2/html5/thumbnails/33.jpg)
33
Counting Network
![Page 34: 1 Sorting Networks. 2 10 9 4 3 2 1 8 7 9 4 3 2 1 8 7 Sorting](https://reader033.vdocuments.us/reader033/viewer/2022051105/5a4d1b727f8b9ab0599b59f2/html5/thumbnails/34.jpg)
34
Balancer
Inputs Outputs
Token
![Page 35: 1 Sorting Networks. 2 10 9 4 3 2 1 8 7 9 4 3 2 1 8 7 Sorting](https://reader033.vdocuments.us/reader033/viewer/2022051105/5a4d1b727f8b9ab0599b59f2/html5/thumbnails/35.jpg)
35
Balancer
Inputs Outputs
![Page 36: 1 Sorting Networks. 2 10 9 4 3 2 1 8 7 9 4 3 2 1 8 7 Sorting](https://reader033.vdocuments.us/reader033/viewer/2022051105/5a4d1b727f8b9ab0599b59f2/html5/thumbnails/36.jpg)
36
Balancer
![Page 37: 1 Sorting Networks. 2 10 9 4 3 2 1 8 7 9 4 3 2 1 8 7 Sorting](https://reader033.vdocuments.us/reader033/viewer/2022051105/5a4d1b727f8b9ab0599b59f2/html5/thumbnails/37.jpg)
37
Balancer
![Page 38: 1 Sorting Networks. 2 10 9 4 3 2 1 8 7 9 4 3 2 1 8 7 Sorting](https://reader033.vdocuments.us/reader033/viewer/2022051105/5a4d1b727f8b9ab0599b59f2/html5/thumbnails/38.jpg)
38
Balancer
![Page 39: 1 Sorting Networks. 2 10 9 4 3 2 1 8 7 9 4 3 2 1 8 7 Sorting](https://reader033.vdocuments.us/reader033/viewer/2022051105/5a4d1b727f8b9ab0599b59f2/html5/thumbnails/39.jpg)
39
Balancer
![Page 40: 1 Sorting Networks. 2 10 9 4 3 2 1 8 7 9 4 3 2 1 8 7 Sorting](https://reader033.vdocuments.us/reader033/viewer/2022051105/5a4d1b727f8b9ab0599b59f2/html5/thumbnails/40.jpg)
40
Balancer
![Page 41: 1 Sorting Networks. 2 10 9 4 3 2 1 8 7 9 4 3 2 1 8 7 Sorting](https://reader033.vdocuments.us/reader033/viewer/2022051105/5a4d1b727f8b9ab0599b59f2/html5/thumbnails/41.jpg)
41
Balancer
![Page 42: 1 Sorting Networks. 2 10 9 4 3 2 1 8 7 9 4 3 2 1 8 7 Sorting](https://reader033.vdocuments.us/reader033/viewer/2022051105/5a4d1b727f8b9ab0599b59f2/html5/thumbnails/42.jpg)
42
Balancer
All tokens together
![Page 43: 1 Sorting Networks. 2 10 9 4 3 2 1 8 7 9 4 3 2 1 8 7 Sorting](https://reader033.vdocuments.us/reader033/viewer/2022051105/5a4d1b727f8b9ab0599b59f2/html5/thumbnails/43.jpg)
43
Balancer
Step property
![Page 44: 1 Sorting Networks. 2 10 9 4 3 2 1 8 7 9 4 3 2 1 8 7 Sorting](https://reader033.vdocuments.us/reader033/viewer/2022051105/5a4d1b727f8b9ab0599b59f2/html5/thumbnails/44.jpg)
44
Balancer
Step property
Another example
![Page 45: 1 Sorting Networks. 2 10 9 4 3 2 1 8 7 9 4 3 2 1 8 7 Sorting](https://reader033.vdocuments.us/reader033/viewer/2022051105/5a4d1b727f8b9ab0599b59f2/html5/thumbnails/45.jpg)
45
Balancer
Step property
Another example
![Page 46: 1 Sorting Networks. 2 10 9 4 3 2 1 8 7 9 4 3 2 1 8 7 Sorting](https://reader033.vdocuments.us/reader033/viewer/2022051105/5a4d1b727f8b9ab0599b59f2/html5/thumbnails/46.jpg)
46
Balancer
Step property
Another example
![Page 47: 1 Sorting Networks. 2 10 9 4 3 2 1 8 7 9 4 3 2 1 8 7 Sorting](https://reader033.vdocuments.us/reader033/viewer/2022051105/5a4d1b727f8b9ab0599b59f2/html5/thumbnails/47.jpg)
47
Counting Network
(Bitonic Counting Network)
![Page 48: 1 Sorting Networks. 2 10 9 4 3 2 1 8 7 9 4 3 2 1 8 7 Sorting](https://reader033.vdocuments.us/reader033/viewer/2022051105/5a4d1b727f8b9ab0599b59f2/html5/thumbnails/48.jpg)
48
Counting Network
![Page 49: 1 Sorting Networks. 2 10 9 4 3 2 1 8 7 9 4 3 2 1 8 7 Sorting](https://reader033.vdocuments.us/reader033/viewer/2022051105/5a4d1b727f8b9ab0599b59f2/html5/thumbnails/49.jpg)
49
Counting Network
![Page 50: 1 Sorting Networks. 2 10 9 4 3 2 1 8 7 9 4 3 2 1 8 7 Sorting](https://reader033.vdocuments.us/reader033/viewer/2022051105/5a4d1b727f8b9ab0599b59f2/html5/thumbnails/50.jpg)
50
Counting Network
![Page 51: 1 Sorting Networks. 2 10 9 4 3 2 1 8 7 9 4 3 2 1 8 7 Sorting](https://reader033.vdocuments.us/reader033/viewer/2022051105/5a4d1b727f8b9ab0599b59f2/html5/thumbnails/51.jpg)
51
Counting Network
![Page 52: 1 Sorting Networks. 2 10 9 4 3 2 1 8 7 9 4 3 2 1 8 7 Sorting](https://reader033.vdocuments.us/reader033/viewer/2022051105/5a4d1b727f8b9ab0599b59f2/html5/thumbnails/52.jpg)
52
Counting Network
![Page 53: 1 Sorting Networks. 2 10 9 4 3 2 1 8 7 9 4 3 2 1 8 7 Sorting](https://reader033.vdocuments.us/reader033/viewer/2022051105/5a4d1b727f8b9ab0599b59f2/html5/thumbnails/53.jpg)
53
Counting Network
![Page 54: 1 Sorting Networks. 2 10 9 4 3 2 1 8 7 9 4 3 2 1 8 7 Sorting](https://reader033.vdocuments.us/reader033/viewer/2022051105/5a4d1b727f8b9ab0599b59f2/html5/thumbnails/54.jpg)
54
Counting Network
![Page 55: 1 Sorting Networks. 2 10 9 4 3 2 1 8 7 9 4 3 2 1 8 7 Sorting](https://reader033.vdocuments.us/reader033/viewer/2022051105/5a4d1b727f8b9ab0599b59f2/html5/thumbnails/55.jpg)
55
Counting Network
![Page 56: 1 Sorting Networks. 2 10 9 4 3 2 1 8 7 9 4 3 2 1 8 7 Sorting](https://reader033.vdocuments.us/reader033/viewer/2022051105/5a4d1b727f8b9ab0599b59f2/html5/thumbnails/56.jpg)
56
Counting Network
![Page 57: 1 Sorting Networks. 2 10 9 4 3 2 1 8 7 9 4 3 2 1 8 7 Sorting](https://reader033.vdocuments.us/reader033/viewer/2022051105/5a4d1b727f8b9ab0599b59f2/html5/thumbnails/57.jpg)
57
Counting Network
![Page 58: 1 Sorting Networks. 2 10 9 4 3 2 1 8 7 9 4 3 2 1 8 7 Sorting](https://reader033.vdocuments.us/reader033/viewer/2022051105/5a4d1b727f8b9ab0599b59f2/html5/thumbnails/58.jpg)
58
Counting Network
![Page 59: 1 Sorting Networks. 2 10 9 4 3 2 1 8 7 9 4 3 2 1 8 7 Sorting](https://reader033.vdocuments.us/reader033/viewer/2022051105/5a4d1b727f8b9ab0599b59f2/html5/thumbnails/59.jpg)
59
Counting Network
![Page 60: 1 Sorting Networks. 2 10 9 4 3 2 1 8 7 9 4 3 2 1 8 7 Sorting](https://reader033.vdocuments.us/reader033/viewer/2022051105/5a4d1b727f8b9ab0599b59f2/html5/thumbnails/60.jpg)
60
Counting Network
![Page 61: 1 Sorting Networks. 2 10 9 4 3 2 1 8 7 9 4 3 2 1 8 7 Sorting](https://reader033.vdocuments.us/reader033/viewer/2022051105/5a4d1b727f8b9ab0599b59f2/html5/thumbnails/61.jpg)
61
Counting Network
![Page 62: 1 Sorting Networks. 2 10 9 4 3 2 1 8 7 9 4 3 2 1 8 7 Sorting](https://reader033.vdocuments.us/reader033/viewer/2022051105/5a4d1b727f8b9ab0599b59f2/html5/thumbnails/62.jpg)
62
Counting Network
![Page 63: 1 Sorting Networks. 2 10 9 4 3 2 1 8 7 9 4 3 2 1 8 7 Sorting](https://reader033.vdocuments.us/reader033/viewer/2022051105/5a4d1b727f8b9ab0599b59f2/html5/thumbnails/63.jpg)
63
Counting Network
![Page 64: 1 Sorting Networks. 2 10 9 4 3 2 1 8 7 9 4 3 2 1 8 7 Sorting](https://reader033.vdocuments.us/reader033/viewer/2022051105/5a4d1b727f8b9ab0599b59f2/html5/thumbnails/64.jpg)
64
Counting Network
![Page 65: 1 Sorting Networks. 2 10 9 4 3 2 1 8 7 9 4 3 2 1 8 7 Sorting](https://reader033.vdocuments.us/reader033/viewer/2022051105/5a4d1b727f8b9ab0599b59f2/html5/thumbnails/65.jpg)
65
Counting Network
All tokens
![Page 66: 1 Sorting Networks. 2 10 9 4 3 2 1 8 7 9 4 3 2 1 8 7 Sorting](https://reader033.vdocuments.us/reader033/viewer/2022051105/5a4d1b727f8b9ab0599b59f2/html5/thumbnails/66.jpg)
66
Counting Network
All tokens Step property
![Page 67: 1 Sorting Networks. 2 10 9 4 3 2 1 8 7 9 4 3 2 1 8 7 Sorting](https://reader033.vdocuments.us/reader033/viewer/2022051105/5a4d1b727f8b9ab0599b59f2/html5/thumbnails/67.jpg)
67
Counting Network
Another example Step property
![Page 68: 1 Sorting Networks. 2 10 9 4 3 2 1 8 7 9 4 3 2 1 8 7 Sorting](https://reader033.vdocuments.us/reader033/viewer/2022051105/5a4d1b727f8b9ab0599b59f2/html5/thumbnails/68.jpg)
68
Counting Network
Another example Step property
![Page 69: 1 Sorting Networks. 2 10 9 4 3 2 1 8 7 9 4 3 2 1 8 7 Sorting](https://reader033.vdocuments.us/reader033/viewer/2022051105/5a4d1b727f8b9ab0599b59f2/html5/thumbnails/69.jpg)
69
Counting Network
Another example Step property
![Page 70: 1 Sorting Networks. 2 10 9 4 3 2 1 8 7 9 4 3 2 1 8 7 Sorting](https://reader033.vdocuments.us/reader033/viewer/2022051105/5a4d1b727f8b9ab0599b59f2/html5/thumbnails/70.jpg)
70
Counting Network
Another example Step property
![Page 71: 1 Sorting Networks. 2 10 9 4 3 2 1 8 7 9 4 3 2 1 8 7 Sorting](https://reader033.vdocuments.us/reader033/viewer/2022051105/5a4d1b727f8b9ab0599b59f2/html5/thumbnails/71.jpg)
71
Counting Network
ParallelismMany increment requests are processed simultaneously
![Page 72: 1 Sorting Networks. 2 10 9 4 3 2 1 8 7 9 4 3 2 1 8 7 Sorting](https://reader033.vdocuments.us/reader033/viewer/2022051105/5a4d1b727f8b9ab0599b59f2/html5/thumbnails/72.jpg)
72
Counting
0123
Token = Increment request
Output Shared variables
![Page 73: 1 Sorting Networks. 2 10 9 4 3 2 1 8 7 9 4 3 2 1 8 7 Sorting](https://reader033.vdocuments.us/reader033/viewer/2022051105/5a4d1b727f8b9ab0599b59f2/html5/thumbnails/73.jpg)
73
Counting
0123
Output Shared variables
![Page 74: 1 Sorting Networks. 2 10 9 4 3 2 1 8 7 9 4 3 2 1 8 7 Sorting](https://reader033.vdocuments.us/reader033/viewer/2022051105/5a4d1b727f8b9ab0599b59f2/html5/thumbnails/74.jpg)
74
Counting
4123
0Returned value
Shared variable value is increased by 4 (output width)
![Page 75: 1 Sorting Networks. 2 10 9 4 3 2 1 8 7 9 4 3 2 1 8 7 Sorting](https://reader033.vdocuments.us/reader033/viewer/2022051105/5a4d1b727f8b9ab0599b59f2/html5/thumbnails/75.jpg)
75
Counting
4123
0
Increment request
![Page 76: 1 Sorting Networks. 2 10 9 4 3 2 1 8 7 9 4 3 2 1 8 7 Sorting](https://reader033.vdocuments.us/reader033/viewer/2022051105/5a4d1b727f8b9ab0599b59f2/html5/thumbnails/76.jpg)
76
Counting
4123
0
![Page 77: 1 Sorting Networks. 2 10 9 4 3 2 1 8 7 9 4 3 2 1 8 7 Sorting](https://reader033.vdocuments.us/reader033/viewer/2022051105/5a4d1b727f8b9ab0599b59f2/html5/thumbnails/77.jpg)
77
Counting
4523
0
1
Returned value
![Page 78: 1 Sorting Networks. 2 10 9 4 3 2 1 8 7 9 4 3 2 1 8 7 Sorting](https://reader033.vdocuments.us/reader033/viewer/2022051105/5a4d1b727f8b9ab0599b59f2/html5/thumbnails/78.jpg)
78
Counting
4523
0
1
Increment request
![Page 79: 1 Sorting Networks. 2 10 9 4 3 2 1 8 7 9 4 3 2 1 8 7 Sorting](https://reader033.vdocuments.us/reader033/viewer/2022051105/5a4d1b727f8b9ab0599b59f2/html5/thumbnails/79.jpg)
79
Counting
4563
0
1
2
Returned value
![Page 80: 1 Sorting Networks. 2 10 9 4 3 2 1 8 7 9 4 3 2 1 8 7 Sorting](https://reader033.vdocuments.us/reader033/viewer/2022051105/5a4d1b727f8b9ab0599b59f2/html5/thumbnails/80.jpg)
80
Counting
4563
0
1
2
![Page 81: 1 Sorting Networks. 2 10 9 4 3 2 1 8 7 9 4 3 2 1 8 7 Sorting](https://reader033.vdocuments.us/reader033/viewer/2022051105/5a4d1b727f8b9ab0599b59f2/html5/thumbnails/81.jpg)
81
Counting
4567
0
1
2
3
Returned value
![Page 82: 1 Sorting Networks. 2 10 9 4 3 2 1 8 7 9 4 3 2 1 8 7 Sorting](https://reader033.vdocuments.us/reader033/viewer/2022051105/5a4d1b727f8b9ab0599b59f2/html5/thumbnails/82.jpg)
82
Counting
4567
0
1
2
3
![Page 83: 1 Sorting Networks. 2 10 9 4 3 2 1 8 7 9 4 3 2 1 8 7 Sorting](https://reader033.vdocuments.us/reader033/viewer/2022051105/5a4d1b727f8b9ab0599b59f2/html5/thumbnails/83.jpg)
83
Counting
8567
0
1
2
3
4Returned value
![Page 84: 1 Sorting Networks. 2 10 9 4 3 2 1 8 7 9 4 3 2 1 8 7 Sorting](https://reader033.vdocuments.us/reader033/viewer/2022051105/5a4d1b727f8b9ab0599b59f2/html5/thumbnails/84.jpg)
84
Counting
8567
0
1
2
3
4
![Page 85: 1 Sorting Networks. 2 10 9 4 3 2 1 8 7 9 4 3 2 1 8 7 Sorting](https://reader033.vdocuments.us/reader033/viewer/2022051105/5a4d1b727f8b9ab0599b59f2/html5/thumbnails/85.jpg)
85
Counting
8967
0
1
2
3
4
5
Returned value
![Page 86: 1 Sorting Networks. 2 10 9 4 3 2 1 8 7 9 4 3 2 1 8 7 Sorting](https://reader033.vdocuments.us/reader033/viewer/2022051105/5a4d1b727f8b9ab0599b59f2/html5/thumbnails/86.jpg)
86
Counting
8967
0
1
2
3
4
5
All tokens
![Page 87: 1 Sorting Networks. 2 10 9 4 3 2 1 8 7 9 4 3 2 1 8 7 Sorting](https://reader033.vdocuments.us/reader033/viewer/2022051105/5a4d1b727f8b9ab0599b59f2/html5/thumbnails/87.jpg)
87
Bitonic Counting Network
Isomorphic to Bitonic Sorting Network
![Page 88: 1 Sorting Networks. 2 10 9 4 3 2 1 8 7 9 4 3 2 1 8 7 Sorting](https://reader033.vdocuments.us/reader033/viewer/2022051105/5a4d1b727f8b9ab0599b59f2/html5/thumbnails/88.jpg)
88
Count(n)
Count(n/2)
Count(n/2)
Merge(n)In Out
)(log2 nOdepth
X
Y
Z
![Page 89: 1 Sorting Networks. 2 10 9 4 3 2 1 8 7 9 4 3 2 1 8 7 Sorting](https://reader033.vdocuments.us/reader033/viewer/2022051105/5a4d1b727f8b9ab0599b59f2/html5/thumbnails/89.jpg)
89
Merge(n)
Merge1(n/2)
Merge2(n/2)
)(lognOdepth
X
Y
Z
StepProp.
StepProp.
StepProp.
![Page 90: 1 Sorting Networks. 2 10 9 4 3 2 1 8 7 9 4 3 2 1 8 7 Sorting](https://reader033.vdocuments.us/reader033/viewer/2022051105/5a4d1b727f8b9ab0599b59f2/html5/thumbnails/90.jpg)
90
X
0x1x2x3x4x5x6x7x
oddX
0x1x2x3x4x5x6x7x
evenX
0x1x2x3x4x5x6x7x
Even subsequence
Odd subsequence
![Page 91: 1 Sorting Networks. 2 10 9 4 3 2 1 8 7 9 4 3 2 1 8 7 Sorting](https://reader033.vdocuments.us/reader033/viewer/2022051105/5a4d1b727f8b9ab0599b59f2/html5/thumbnails/91.jpg)
91
Merge(n)
Merge1(n/2)
Merge2(n/2)
X
Y
Z
evenX
oddY
evenY
oddX
A
B
![Page 92: 1 Sorting Networks. 2 10 9 4 3 2 1 8 7 9 4 3 2 1 8 7 Sorting](https://reader033.vdocuments.us/reader033/viewer/2022051105/5a4d1b727f8b9ab0599b59f2/html5/thumbnails/92.jpg)
92
Theorem:
Proof:The proof is by induction on n
For the merger is a balancer andthe claim holds trivially.
2nInduction Basis:
The merger(n) produces output Z with step property if both inputs X and Y have step property
![Page 93: 1 Sorting Networks. 2 10 9 4 3 2 1 8 7 9 4 3 2 1 8 7 Sorting](https://reader033.vdocuments.us/reader033/viewer/2022051105/5a4d1b727f8b9ab0599b59f2/html5/thumbnails/93.jpg)
93
Induction Hypothesis:
Merge(n/2)
If step sequence
If step sequence
Then stepsequence
Assume that every merger of size n/2 and smallerperforms merging properly
![Page 94: 1 Sorting Networks. 2 10 9 4 3 2 1 8 7 9 4 3 2 1 8 7 Sorting](https://reader033.vdocuments.us/reader033/viewer/2022051105/5a4d1b727f8b9ab0599b59f2/html5/thumbnails/94.jpg)
94
Merge(n)
Induction step:
If step
If stepThen step
We want to show that:
X
YZ
Suppose and have the step property.Then we show that has the step property
X YZ
![Page 95: 1 Sorting Networks. 2 10 9 4 3 2 1 8 7 9 4 3 2 1 8 7 Sorting](https://reader033.vdocuments.us/reader033/viewer/2022051105/5a4d1b727f8b9ab0599b59f2/html5/thumbnails/95.jpg)
95
0x
2x
4x
6x
1x
3x
5x
7x
evenX
oddX
0x1x2x3x4x5x6x7x
X
If has the step propertythen and have the step property
XevenX oddX
Tokens
![Page 96: 1 Sorting Networks. 2 10 9 4 3 2 1 8 7 9 4 3 2 1 8 7 Sorting](https://reader033.vdocuments.us/reader033/viewer/2022051105/5a4d1b727f8b9ab0599b59f2/html5/thumbnails/96.jpg)
96
Merge1(n/2)evenX
oddYA
Merge2(n/2)evenY
oddX
B
step
step
step
step
step
step
Therefore, from induction hypothesis:
Output sequence
Output sequence
![Page 97: 1 Sorting Networks. 2 10 9 4 3 2 1 8 7 9 4 3 2 1 8 7 Sorting](https://reader033.vdocuments.us/reader033/viewer/2022051105/5a4d1b727f8b9ab0599b59f2/html5/thumbnails/97.jpg)
97
First, we show: 1||||1 BA
Where denotes the total number oftokens in sequence
||AA
![Page 98: 1 Sorting Networks. 2 10 9 4 3 2 1 8 7 9 4 3 2 1 8 7 Sorting](https://reader033.vdocuments.us/reader033/viewer/2022051105/5a4d1b727f8b9ab0599b59f2/html5/thumbnails/98.jpg)
98
We have: |||||| oddeven YXA
|||||| oddeven XYB
Merger 1
Merger 2
![Page 99: 1 Sorting Networks. 2 10 9 4 3 2 1 8 7 9 4 3 2 1 8 7 Sorting](https://reader033.vdocuments.us/reader033/viewer/2022051105/5a4d1b727f8b9ab0599b59f2/html5/thumbnails/99.jpg)
99
|||| oddeven XX 1|||| oddeven XXor0x1x2x3x4x5x6x7x
0x1x2x3x4x5x6x7x
Since has the step property:X
Therefore: 1||||0 oddeven XX
Similarly: 1||||0 oddeven YY
![Page 100: 1 Sorting Networks. 2 10 9 4 3 2 1 8 7 9 4 3 2 1 8 7 Sorting](https://reader033.vdocuments.us/reader033/viewer/2022051105/5a4d1b727f8b9ab0599b59f2/html5/thumbnails/100.jpg)
100
|)||(||)||(||||| evenoddoddeven YYXXBA
1||||0 oddeven XX
1||||0 oddeven YY
1||||1 BA
![Page 101: 1 Sorting Networks. 2 10 9 4 3 2 1 8 7 9 4 3 2 1 8 7 Sorting](https://reader033.vdocuments.us/reader033/viewer/2022051105/5a4d1b727f8b9ab0599b59f2/html5/thumbnails/101.jpg)
101
Now, we show that has the step propertyZ
1||||1 BA
A Bc
i i
ccc
1c 1c1c1c
ccccc
1c1c1c
There is at most one wire where the two sequences differ
#tokens
i
#tokensstep step
![Page 102: 1 Sorting Networks. 2 10 9 4 3 2 1 8 7 9 4 3 2 1 8 7 Sorting](https://reader033.vdocuments.us/reader033/viewer/2022051105/5a4d1b727f8b9ab0599b59f2/html5/thumbnails/102.jpg)
102
A
B
c
i
i
ccc1c1c1c1c
ccccc
1c1c1c
cccc
c1c
1c1c
1c1c
cccc
c1c
1c1c
1c1c
Z
Stepproperty
Mer
ge1(
n/2)
Mer
ge(n
/2)
Merge(n)