1 / 42

Lecture 4 Sorting Networks

Lecture 4 Sorting Networks. Comparator. comparator. A 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. Depth. 2. 2. 9. 5. 6. 5. 9. 5. 2. 5. 6.

jocelync
Download Presentation

Lecture 4 Sorting Networks

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Lecture 4Sorting Networks

  2. Comparator comparator

  3. A 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.

  4. Depth 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 pathfrom an input wire to an output wire.

  5. Depth = 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 pathfrom an input wire to an output wire.

  6. Insertion Sort

  7. key

  8. Sorting network constructed from insertion sort.

  9. How to construct a sortingnetwork 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 0 0 0 0 bitonic clean 1 0 1 0 bitonic 1 1 0 0 bitonic 1 0 0 1

  22. The half-cleaner 0 0 0 0 bitonic 1 1 1 0 bitonic 1 1 1 1 bitonic clean 1 1 0 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) 0 0 1 0 1 1 0 0 0

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

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

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

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

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

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

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

  32. bitonic sorted Half cleaners

  33. 0 0 0 0 sorted 0 0 1 0 sorted 0 0 0 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

More Related