May 2015Sorting NetworksSlide 1 Sorting Networks A Lecture in CE Freshman Seminar Series: Ten Puzzling Problems in Computer Engineering.

Slides:



Advertisements
Similar presentations
II Extreme Models Study the two extremes of parallel computation models: Abstract SM (PRAM); ignores implementation issues Concrete circuit model; incorporates.
Advertisements

Apr. 2007SatisfiabilitySlide 1 Satisfiability A Lecture in CE Freshman Seminar Series: Ten Puzzling Problems in Computer Engineering.
CSC321: 2011 Introduction to Neural Networks and Machine Learning Lecture 7: Learning in recurrent networks Geoffrey Hinton.
Batcher’s merging network Efficient Parallel Algorithms COMP308.
Nov. 2005Math in ComputersSlide 1 Math in Computers A Lesson in the “Math + Fun!” Series.
May 2005Special NumbersSlide 1 Special Numbers A Lesson in the “Math + Fun!” Series.
Traffic Flow Analysis Steve Prevette Burnt Hills & Big Flats RR Pasco WA Fluor Hanford City University.
Apr. 2007Mathematical IllusionsSlide 1 Mathematical Illusions A Lesson in the “Math + Fun!” Series.
May 2015String MatchingSlide 1 String Matching A Lecture in CE Freshman Seminar Series: Ten Puzzling Problems in Computer Engineering.
May 2015Binary SearchSlide 1 Binary Search A Lecture in CE Freshman Seminar Series: Ten Puzzling Problems in Computer Engineering.
IP Telephony Project By: Liane Lewin Shahar Eytan Guided By: Ran Cohen - IBM Vitali Sokhin - Technion.
May 2007Task SchedulingSlide 1 Task Scheduling A Lecture in CE Freshman Seminar Series: Ten Puzzling Problems in Computer Engineering.
Apr. 2015SatisfiabilitySlide 1 Satisfiability A Lecture in CE Freshman Seminar Series: Ten Puzzling Problems in Computer Engineering.
June 2007Malfunction DiagnosisSlide 1 Malfunction Diagnosis A Lecture in CE Freshman Seminar Series: Ten Puzzling Problems in Computer Engineering.
Mar. 2006Measuring InstrumentsSlide 1 Measuring Instruments A Lesson in the “Math + Fun!” Series.
Apr. 2007Placement and RoutingSlide 1 Placement and Routing A Lecture in CE Freshman Seminar Series: Ten Puzzling Problems in Computer Engineering.
Mar. 2015Easy, Hard, Impossible!Slide 1 Easy, Hard, Impossible! A Lecture in CE Freshman Seminar Series: Puzzling Problems in Computer Engineering.
Nov. 2004Math and ElectionsSlide 1 Math and Elections A Lesson in the “Math + Fun!” Series.
Dec. 2004Math CrosswordsSlide 1 Math Crosswords A Lesson in the “Math + Fun!” Series.
Apr. 2007Easy, Hard, Impossible!Slide 1 Easy, Hard, Impossible! A Lecture in CE Freshman Seminar Series: Ten Puzzling Problems in Computer Engineering.
May 2007Binary SearchSlide 1 Binary Search A Lecture in CE Freshman Seminar Series: Ten Puzzling Problems in Computer Engineering.
Mesh connected networks. Sorting algorithms Efficient Parallel Algorithms COMP308.
HandoutMay 2007Sorting Networks A Lecture in CE Freshman Seminar Series: Ten Puzzling Problems in Computer Engineering.
May 2012Malfunction DiagnosisSlide 1 Malfunction Diagnosis A Lecture in CE Freshman Seminar Series: Ten Puzzling Problems in Computer Engineering.
May 2012Task SchedulingSlide 1 Task Scheduling A Lecture in CE Freshman Seminar Series: Ten Puzzling Problems in Computer Engineering.
Selection Sort, Insertion Sort, Bubble, & Shellsort
Apr. 2015Placement and RoutingSlide 1 Placement and Routing A Lecture in CE Freshman Seminar Series: Puzzling Problems in Computer Engineering.
May 2007String MatchingSlide 1 String Matching A Lecture in CE Freshman Seminar Series: Ten Puzzling Problems in Computer Engineering.
HandoutLecture 9Sorting Networks Rearranging Trains BADC Stub or lead BADC Sorted order BADC Stub or lead Stack or LIFO data structure in CE BADC Stub.
1 25\10\2010 Unit-V Connecting LANs Unit – 5 Connecting DevicesConnecting Devices Backbone NetworksBackbone Networks Virtual LANsVirtual LANs.
Data Communications and Networking
Lecture 2 TCP/IP Protocol Suite Reference: TCP/IP Protocol Suite, 4 th Edition (chapter 2) 1.
90-723: Data Structures and Algorithms for Information Processing Copyright © 1999, Carnegie Mellon. All Rights Reserved. 1 Lecture 5: Stacks and Queues.
Lecture 12: Parallel Sorting Shantanu Dutt ECE Dept. UIC.
Sami Al-wakeel 1 Data Transmission and Computer Networks The Switching Networks.
Switching Techniques Dr. Sanjay P. Ahuja, Ph.D. Fidelity National Financial Distinguished Professor of CIS School of Computing, UNF.
Dr. Clincy1 Chapter 6 Delivery & Forwarding of IP Packets Lecture #4 Items you should understand by now – before routing Physical Addressing – with in.
Chapter 6 Delivery and Forwarding of IP Packets
Lecture 6 Algorithm Analysis Arne Kutzner Hanyang University / Seoul Korea.
25-Oct-15Network Layer Connecting Devices Networks do not normally operate in isolation.They are connected to one another using connecting devices. The.
Computer Networks: Switching and Queuing Ivan Marsic Rutgers University Chapter 4 – Switching and Queuing Delay Models.
Lecture # 03 Switching Course Instructor: Engr. Sana Ziafat.
Unit-8 Sorting Algorithms Prepared By:-H.M.PATEL.
Neural Networks Lecture 11: Learning in recurrent networks Geoffrey Hinton.
Computer Communication & Networks Lecture # 03 Circuit Switching, Packet Switching Nadeem Majeed Choudhary
Sorting: Parallel Compare Exchange Operation A parallel compare-exchange operation. Processes P i and P j send their elements to each other. Process P.
1 Kyung Hee University Chapter 8 Switching. 2 Kyung Hee University Switching  Switching  Switches are devices capable of creating temporary connections.
Antenna Arrays and Automotive Applications
May 2007Sorting NetworksSlide 1 Sorting Networks A Lecture in CE Freshman Seminar Series: Ten Puzzling Problems in Computer Engineering.
CE2303 Railway Engineering
CMSC201 Computer Science I for Majors Lecture 19 – Recursion (Continued) Prof. Katherine Gibson Prof. Jeremy Dixon Based on slides from UPenn’s.
Lecture 4 Sorting Networks
Mesh connected networks. Sorting algorithms
7.1 What is a Sorting Network?
Forwarding and Routing IP Packets
Mathematical Illusions
Recommender Systems A Lecture in the Freshman Seminar Series:
3D Models from 2D Images A Lecture in the Freshman Seminar Series:
Satisfiability A Lecture in CE Freshman Seminar Series:
Recommender Systems A Lecture in the Freshman Seminar Series:
Easy, Hard, Impossible! A Lecture in CE Freshman Seminar Series:
Placement and Routing A Lecture in CE Freshman Seminar Series:
Sorting Networks A Lecture in CE Freshman Seminar Series:
3D Models from 2D Images A Lecture in the Freshman Seminar Series:
Easy, Hard, Impossible! A Lecture in CE Freshman Seminar Series:
Malfunction Diagnosis
Last Class We Covered Recursion Stacks Parts of a recursive function:
Binary Search A Lecture in CE Freshman Seminar Series:
Mathematical Illusions
Task Scheduling A Lecture in CE Freshman Seminar Series:
Presentation transcript:

May 2015Sorting NetworksSlide 1 Sorting Networks A Lecture in CE Freshman Seminar Series: Ten Puzzling Problems in Computer Engineering

May 2015Sorting NetworksSlide 2 About This Presentation This presentation belongs to the lecture series entitled “Ten Puzzling Problems in Computer Engineering,” devised for a ten-week, one-unit, freshman seminar course by Behrooz Parhami, Professor of Computer Engineering at University of California, Santa Barbara. The material can be used freely in teaching and other educational settings. Unauthorized uses, including any use for financial gain, are prohibited. © Behrooz Parhami EditionReleasedRevised First May 2007May 2008May 2009May 2010May 2011 May 2012May 2015

Sorting NetworksSlide 3 Railroad Tracks and Switches

May 2015Sorting NetworksSlide 4 Coupling and Decoupling of Train Cars Train cars and engines can be coupled and decoupled quickly An engine can push a string of cars, or pull a desired subset by decoupling them from the rest

May 2015Sorting NetworksSlide 5 Railroad Yards Have Many Tracks and Switches

May 2015Sorting NetworksSlide 6 Rearranging Trains BADC Sorted order BADC Stub or lead Stack or LIFO data structure in CE Sorting algorithm: Assemble train in stub, beginning with the last car Repeat: If the next car is X, decouple train after X, push X into stub BADC Siding Queue or FIFO BADC Track Train cars Engine BADC Stub or lead BA DC

May 2015Sorting NetworksSlide 7 Goleta Amtrak Station and Its Siding

May 2015Sorting NetworksSlide 8

May 2015Sorting NetworksSlide 9 Rearrangement with Change of Direction BADC Turnaround loop BADC What types of sorting are possible with a turnaround loop? A wye? BADC Wye B A D C Configuration after the first few steps in sorting the train Complete the sorting process, assuming that it is okay for the engine to end up behind the train

May 2015Sorting NetworksSlide 10

May 2015Sorting NetworksSlide 11 Delivering Train Cars in a Specific Order 1 BADC 2 3 Cars in the train below have been sorted according to their delivery points. However, it is still nontrivial to deposit car A in stub 1, car B in stub 2, and car C in siding 3. Cars can be pulled or pushed by the engine. 1 C 2 3 BAD 1 C 2 3 BA D Is there a better initial ordering of the cars for the deliveries in this puzzle?

May 2015Sorting NetworksSlide 12 Train Passing Puzzle The trains below must pass each other using a siding that can hold only one car or one engine. Show how this can be done. BA21BA21B21 A B21 A 2 1 A B 2A B 1

May 2015Sorting NetworksSlide 13 Fast Combining or Reordering of Train Cars Forming multiple trains from incoming cars BADCBADC Train reordering via a set of stubs Cars are pushed or pulled by an engine Alternatively, movement in one direction may be achieved via sloped rails Switches used to be adjusted manually, but nowadays, electronic control is used

May 2015Sorting NetworksSlide Track 1 Track 2 Track 3 Track 4 Sorting Train Cars in Parallel Compare-exchange Unconditional exchange Target track The net in stick diagram schematic Track 1 Track 2 Track 3 Track Is adding this compare-exchange element sufficient for producing a valid sorting network?

May 2015Sorting NetworksSlide 15 Validating a Sorting Network Stick diagram schematic b a d c Track 1 Track 2 Track 3 Track 4 min(a, b) max(a, b) min(c, d) max(c, d) min(a, b, c, d) max(a, b, c, d) ???? In the example above, it was fairly easy to show the validity of the sorting network. Generally, it is much more difficult How would one establish the validity of this 16-input sorting network? More importantly, how does one come up with this design in the first place?

May 2015Sorting NetworksSlide 16 The Zero-One Principle A sorting net built of comparators is valid if it correctly sorts all 0-1 sequences So, we can validate a sorting network using 2 n rather than n! input patterns n = 12: 2 n = 4096, n! = 479,001,600 (thousands vs. half a billion)

May 2015Sorting NetworksSlide 17 A 16-Input Sorting Network Use 4-input sorters, follow by (4, 4)-mergers, and end with an (8, 8)-merger Using the 0-1 principle, we can validate this network via tests sorter tests(4, 4)-merger tests(8, 8)-merger tests

May 2015Sorting NetworksSlide 18 Insertion Sort and Selection Sort Fig. 7.8 Sorting network based on insertion sort or selection sort. C(n) = n(n – 1)/2 D(n ) = 2n – 3 Cost  Delay =  (n 3 ) Insertion sortSelection sort

May 2015Sorting NetworksSlide 19 The Best Sorting Networks Cost  Delay = 29  9 = 261Cost  Delay = 31  7 = 217 The most cost-effective n-input sorting network may be neither the fastest design, nor the lowest-cost design Criterion 1: The number of sticks or compare-exchange blocks (cost) Criterion 2: The number of compare-exchanges in sequence (delay) Criterion 3: The product of cost and delay (cost-effectiveness) Which 10-input sorting network is better? Cost = 29Cost = 31Delay = 9Delay = 7

May 2015Sorting NetworksSlide 20 Electronic Sorting Networks Electronic sorting networks are built of 2-sorters, building blocks that can sort two inputs Applications of sorting networks: Directing information packets to their destinations in a network router Connecting n processors to n memory modules in a parallel computer abab min(a, b) max(a, b)