160 likes | 403 Views
Batcher Sorting Network, n = 4. Batcher Sorting Network, n = 8. n = 4. n = 4. sorted. sorted. 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. sorted. Lemma 2.
E N D
Batcher Sorting Network, n = 8 n = 4 n = 4
sorted sorted 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
sorted Lemma 2 For a sorted sequence, the number of 0’s in the even subsequence is either equal to, or one greater than, the number of 0’s in the odd subsequence. 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 even odd
Lemma 3 For two sorted sequences and : denotes the the number of 0’s in denotes the even subsequence of denotes the odd subsequence of
0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 1 1 0 0 1 1 1 1 1 1 1 1 1 1 1 1 ¢ ¢ ¢ x x x O E Lemma 3
Lemma 3 For two sorted sequences and : (by Lemma 2) (by Lemma 2)
Merge[4] sorted sorted Merge[4] sorted Merge Network
Merge[4] sorted sorted Merge[4] sorted sorted Merge Network (pf.) (by Lemma 1) (by Lemma 1)
Merge[4] sorted By Lemma 3 and differ by at most 1 Merge[4] sorted Merge Network (pf.)
Merge[4] By Lemma 3 and sorted differ by at most 1 Merge[4] Merge Network (pf.)
Merge[4] By Lemma 3 and differ by at most 1 Merge[4] Merge Network (pf.) 0 0 0 0 1 0 1 0 0 0 0 1 0 1 1 1
Sort[4] Merge[8] sorted Sort[4] Batcher Sorting Network
Merge[4] Batcher Sorting Network, n = 4 Sort[2] Sort[2]
Merge[8] Batcher Sorting Network, n = 8 Sort[4] Sort[4]
AKS (Ajtai, Komlós, Szemerédi) Network: based on expander graphs. AKS better for Sorting Networks AKS (Chvátal) Batcher