Comparison Networks - PowerPoint PPT Presentation

1 / 31
About This Presentation
Title:

Comparison Networks

Description:

Batcher Sorting Network, n = 4. n = 4. n = 4. Batcher Sorting ... Batcher. AKS (Chv tal) AKS (Ajtai, Koml s, Szemer di) Network: based on expander graphs. ... – PowerPoint PPT presentation

Number of Views:21
Avg rating:3.0/5.0
Slides: 32
Provided by: Jehosu1
Category:

less

Transcript and Presenter's Notes

Title: Comparison Networks


1
Comparison Networks
  • Sorting
  • Sorting binary values
  • Sorting arbitrary numbers
  • Implementing symmetric functions

2
Sorting Algorithms
Example
Order of comparisons not fixed in advance.
Not readily implementable in hardware.
3
Sorting Networks
Order of comparisons fixed in advance.
Readily implementable in hardware.
4
Sorting Networks (binary values)
inputs
outputs
1
0
0
0
0
0
Sorting Network
1
0
0
1
0
1
1
1
1
1
5
Comparator (2-sorter)
outputs
inputs
x
min(x, y)
C
y
max(x, y)
6
Comparator (2-sorter)
AON Implementation
outputs
inputs
x
min(x, y)
max(x, y)
y
7
Comparator (2-sorter)
outputs
inputs
min(x, y)
x
max(x, y)
y
8
Comparison Network
9
Comparison Network
n / 2 comparisons per stage
10
Sorting Network
Any ideas?
11
Sorting Network
inputs
outputs
12
Insertion Sort Network
inputs
outputs
depth 2n 3
13
Batcher Sorting Network, n 4
14
Batcher Sorting Network, n 8
n 4
n 4
15
Lemma 1
Any subsequence of a sorted sequence is a sorted
sequence.
0
0
0
0
0
1
1
1
1
1
1
1
1
16
Lemma 2
For a sorted sequence, the number of 0s in the
even subsequence is either equal to, or one
greater than, the number of 0s in the odd
subsequence.
0
0
0
0
0
0
0
0
0
0
1
1
1
1
1
1
even
odd
17
Lemma 3
For two sorted sequences and
denotes the the number of 0s in
denotes the even subsequence of
denotes the odd subsequence of
18
Lemma 3
19
Lemma 3
For two sorted sequences and
(by Lemma 2)
(by Lemma 2)
20
Merge Network
21
Merge Network (pf.)
(by Lemma 1)
(by Lemma 1)
22
Merge Network (pf.)
23
Merge Network (pf.)
24
Merge Network (pf.)
0
0
0
0
1
0
1
0
0
0
0
1
0
1
1
1
25
Batcher Sorting Network
26
Batcher Sorting Network, n 4
Sort2
Sort2
27
Batcher Sorting Network, n 8
Sort4
Sort4
28
Sorting Networks
Batcher
AKS (Chvátal)
29
Implementing XOR
30
Implementing XOR
Sorting Network
31
Symmetric Functions
Sorting Network
Write a Comment
User Comments (0)
About PowerShow.com