Presentation is loading. Please wait.

Presentation is loading. Please wait.

Lecture 4 Sorting Networks

Similar presentations


Presentation on theme: "Lecture 4 Sorting Networks"— Presentation transcript:

1 Lecture 4 Sorting Networks

2 Comparator comparator

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

4 Depth 9 5 2 2 5 9 6 5 2 2 5 6 6 6 9 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 2 5 9 6 5 2 2 5 6 6 6 9 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 Merging network Sorting 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 1 1 bitonic 1 1 bitonic 1 1

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

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

24 Proof (case 1) 1 1 1

25 Proof (case 2) 1 1 1

26 Proof (case 3) 1 1 1 1 1

27 Proof (case 4) 1 1 1 1 1

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

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

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

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

32 bitonic sorted Half cleaners

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

34 Structure Sorting network Merging network Sorting network

35 Sorting Network Merging Networks

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 n n n n m

40 Rearrangeability Theorem

41 Network with 2x2 crossbars

42 Puzzle


Download ppt "Lecture 4 Sorting Networks"

Similar presentations


Ads by Google