Presentation is loading. Please wait.

Presentation is loading. Please wait.

Lecture 4 Sorting Networks. Comparator comparator.

Similar presentations


Presentation on theme: "Lecture 4 Sorting Networks. Comparator comparator."— Presentation transcript:

1 Lecture 4 Sorting Networks

2 Comparator comparator

3 A Sorting Network 9 5 2 6 5 9 2 6 2 5 6 9 2 5 6 9 A sorting network is a comparison network which output monotone nondecreasing sequence for every input.

4 Depth 9 5 2 6 5 9 2 6 2 5 6 9 2 5 6 9 Depth is the maximum number of comparators on a path from an input wire to an output wire.

5 Depth = parallel time 9 5 2 6 5 9 2 6 2 5 6 9 2 5 6 9 Depth is the maximum number of comparators on a path from an input wire to an output wire.

6 Insertion Sort

7 key

8 Sorting network constructed from insertion sort.

9 How to construct a sorting network from merging sort?

10 Divide 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.

11 Merge Sort

12 Procedure

13 Structure Sorting network Sorting network Merging network

14 Construction of Merging Network 0-1 principal. Bitonic sorter. Merging network.

15 0-1 principal

16 Lemma

17 Proof of 0-1 Principal

18 Bitonic Sequence

19 Bitonic 0-1 Sequence

20 Some Properties

21 The half-cleaner bitonic clean bitonic 0 0 0 0 1 0 1 1 0 0 1 1 1 0 0 0

22 The half-cleaner bitonic clean bitonic 0 0 1 0 1 1 1 1 0 0 1 1 1 1 1 0

23 Lemma (a)One of two halfs is bitonic clean. (b) every number in the 1 st half ≤ any element in the 2 nd half.

24 Proof (case 1) 1 0 0 1 0 0 1 0 0

25 Proof (case 2) 1 0 0 1 0 0 1 0 0

26 Proof (case 3) 1 0 0 1 0 0 1 0 0 1 1

27 Proof (case 4) 1 0 0 1 0 0 1 0 0 1 1

28 Proof (case 5) 1 0 0 1 0 1 1 1 1 1 1

29 Proof (case 6) 1 0 0 1 0 1 1 1 1 1 1

30 Proof (case 7) 1 0 0 1 0 1 1 1 1 0 0

31 Proof (case 8) 1 0 0 1 0 1 1 1 1 0 0

32 Half cleaners bitonicsorted

33 Half cleaners sorted 0 0 1 1 0 0 0 1 0 0 0 0 0 1 1 1 Merging Network

34 Structure Sorting network Sorting network Merging network

35 Merging Networks Sorting Network

36 What we learnt in this lecture? What is sorting network? Depth = parallel time. Sorting network from Merge sort.

37 Permutation Network Switching network Rearrangeability Nework with 2x2 crossbars

38 Crossbar Switch A crossbar switch can realize any matching between Inputs and outputs.

39 3-stage Clos Network 1 m n n n n

40 Rearrangeability Theorem

41 Network with 2x2 crossbars

42 Puzzle


Download ppt "Lecture 4 Sorting Networks. Comparator comparator."

Similar presentations


Ads by Google