Title: Lecture 5 Sorting Networks
1Lecture 5Sorting Networks
2Comparator
comparator
3A Sorting Network
2
2
9
5
6
5
9
5
2
5
6
2
6
9
6
9
A sorting network is a comparison network which
output monotone nondecreasing sequence for every
input.
4Depth
2
2
9
5
6
5
9
5
2
5
6
2
6
9
6
9
Depth is the maximum number of comparators on
a path from an input wire to an output wire.
5Depth parallel time
2
2
9
5
6
5
9
5
2
5
6
2
6
9
6
9
Depth is the maximum number of comparators on
a path from an input wire to an output wire.
6Insertion Sort
7key
8Sorting network constructed from insertion sort.
9How to construct a sortingnetwork from merging
sort?
10Divide and Conquer
- Divide the problem into subproblems.
- Conquer the subproblems by solving them
recursively. - Combine the solutions to subproblems into the
solution for original problem.
11Merge Sort
12Procedure
13Structure
Sorting network
Merging network
Sorting network
14Construction of Merging Network
- 0-1 principal.
- Bitonic sorter.
- Merging network.
150-1 principal
16Lemma
17Proof of 0-1 Principal
18Bitonic Sequence
19Bitonic 0-1 Sequence
20Some Properties
21The half-cleaner
0
0
0
0
bitonic clean
0
1
1
0
bitonic
1
1
0
0
bitonic
1
0
0
1
22The half-cleaner
0
0
0
0
bitonic clean
1
1
1
0
bitonic
1
1
1
1
bitonic
1
1
0
1
23Lemma
- One of two halfs is bitonic clean.
- every number in the 1st half any element in
the 2nd half.
24Proof (case 1)
0
0
1
0
1
1
0
0
0
25Proof (case 2)
0
0
1
0
1
0
0
1
0
26Proof (case 3)
0
0
1
0
1
1
1
0
0
0
1
27Proof (case 4)
0
0
1
1
1
0
0
1
1
0
0
28Proof (case 5)
1
1
0
0
1
1
1
1
0
1
1
29Proof (case 6)
1
1
0
1
1
1
0
1
1
0
1
30Proof (case 7)
1
0
1
1
0
0
1
1
0
0
1
31Proof (case 8)
1
0
1
0
1
0
1
0
0
1
1
32bitonic
sorted
Half cleaners
330
0
0
0
sorted
0
0
1
0
sorted
0
0
0
1
sorted
1
1
1
1
Half cleaners
Merging Network
34Structure
Sorting network
Merging network
Sorting network
35Sorting Network
Merging Networks
36What we learnt in this lecture?
- What is sorting network?
- Depth parallel time.
- Sorting network from Merge sort.
37Permutation Network
- Switching network
- Rearrangeability
- Nework with 2x2 crossbars
38Crossbar Switch
A crossbar switch can realize any matching
between Inputs and outputs.
393-stage Clos Network
1
n
n
n
n
m
40Rearrangeability
Theorem
41Network with 2x2 crossbars
42Puzzle