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

Similar documents
CSE Introduction to Parallel Processing. Chapter 7. Sorting and Selection Networks

Placement and Routing A Lecture in CE Freshman Seminar Series: Puzzling Problems in Computer Engineering. Apr Placement and Routing Slide 1

Lesson 10 Using and Sorting Lists

4.5.2 The Distance-Vector (DV) Routing Algorithm

Bridges. Bridge Functions. Example of No-frills Bridge. No-frills Bridges. Example of Learning Bridge. Learning Bridges

Routing Algorithm Classification. A Link-State Routing Algorithm

Discussion 8: Link State Routing. CSE 123: Computer Networks Marti Motoyama & Chris Kanich

Chapter 3 Part 1 Combinational Logic Design

12 Abstract Data Types

CS24 Week 4 Lecture 2

Lecture 7. Network Layer. Network Layer 1-1

4 Using The Derivative

checking for optimal egress point in ibgp routing

Agenda. distance-vector (what you invented last Friday) hierarchical routing routing in the Internet. v DNS assignment Q&A v Routing Algorithms

Design and Performance Evaluation of a New Spatial Reuse FireWire Protocol. Master s thesis defense by Vijay Chandramohan

CSC 4900 Computer Networks: Network Layer

Linked Lists in C and C++

Data Structures. Outline. Introduction Linked Lists Stacks Queues Trees Deitel & Associates, Inc. All rights reserved.

Answers Investigation 4

Informed Search. CMU Snake Robot. Administrative. Uninformed search strategies. Assignment 1 was due before class how d it go?

Announcements. CSCI 334: Principles of Programming Languages. Lecture 19: C++

1.1. Parent Functions and Transformations Essential Question What are the characteristics of some of the basic parent functions?

A closer look at network structure:

CMSC 332 Computer Networks Network Layer

Algebra I. Linear Equations. Slide 1 / 267 Slide 2 / 267. Slide 3 / 267. Slide 3 (Answer) / 267. Slide 4 / 267. Slide 5 / 267

Ceng 111 Fall 2015 Week 12b

Data Struct. & Prob. Solving, M.C.Q. BANK, FOR UNIT 3, SECOND YEAR COMP. ENGG. SEM 1, 2012 PATTERN, U.O.P.

CSE328 Fundamentals of Computer Graphics: Theory, Algorithms, and Applications

CS510 \ Lecture Ariel Stolerman

Pre-Algebra Notes Unit 8: Graphs and Functions

Network Superhighway CSCD 330. Network Programming Winter Lecture 13 Network Layer. Reading: Chapter 4

CS 43: Computer Networks. 20: The Network Layer November 5, 2018

Graphs and Functions

Planning and search. Lecture 1: Introduction and Revision of Search. Lecture 1: Introduction and Revision of Search 1

Non-linear models. Basis expansion. Overfitting. Regularization.

CSE 3214: Computer Network Protocols and Applications Network Layer

Copyright 2011 Sakun Sharma

3.6 Graphing Piecewise-Defined Functions and Shifting and Reflecting Graphs of Functions

WAN Technology and Routing

12 WEEK EXAM NAME: ALPHA: SECTION:

CMPE 150/L : Introduction to Computer Networks. Chen Qian Computer Engineering UCSC Baskin Engineering Lecture 11

Monday, September 28, 2015

PLEASE READ CAREFULLY BEFORE YOU START

Distributed Algorithms in Networks EECS 122: Lecture 17

The wolf sheep cabbage problem. Search. Terminology. Solution. Finite state acceptor / state space

Intelligent Agents. Foundations of Artificial Intelligence. Problem-Solving as Search. A Simple Reflex Agent. Agent with Model and Internal State

Announcements. CS 5565 Network Architecture and Protocols. Count-To-Infinity. Poisoned Reverse. Distance Vector: Link Cost Changes.

Configuring NAT for IP Address Conservation

Sorting Algorithms Day 2 4/5/17

Lecture 2: Divide&Conquer Paradigm, Merge sort and Quicksort

11/13/2017 Network Layer (SSL) Network-layer functions. Recall the two network-layer functions:

3/1/2016. Calculus: A Reminder. Calculus: A Reminder. Calculus: A Reminder. Calculus: A Reminder. Calculus: A Reminder. Calculus: A Reminder

Lecture 2: Internet Structure

Chapter 18 and 22. IPv4 Address. Data Communications and Networking

Class Overview. Introduction to Artificial Intelligence COMP 3501 / COMP Lecture 2: Search. Problem Solving Agents

Module 1: Asymptotic Time Complexity and Intro to Abstract Data Types

CSC Design and Analysis of Algorithms

5.2 Switching Fabric Topologies

CSC Design and Analysis of Algorithms. Lecture 6. Divide and Conquer Algorithm Design Technique. Divide-and-Conquer

1. Which of the following circuits can be used to store one bit of data? A) Encoder B) OR gate C) Flip Flop D) Decoder

Part 8: The Three-Layer DMP Architecture

Internet Architecture. Network Layer Overview. Fundamental Network Layer Function. Protocol Layering and Data. Computer Networks 9/23/2009

SAMPLE OF THE STUDY MATERIAL PART OF CHAPTER 6. Sorting Algorithms

Big Buffer of Switch

Multicast Communications. Slide Set were original prepared by Dr. Tatsuya Susa

CS 4700: Foundations of Artificial Intelligence. Bart Selman. Search Techniques R&N: Chapter 3

3. Priority Queues. ADT Stack : LIFO. ADT Queue : FIFO. ADT Priority Queue : pick the element with the lowest (or highest) priority.

Wednesday, February 19, 2014

Dr Markus Hagenbuchner CSCI319 SIM. Distributed Systems Chapter 4 - Communication

Computer Networks. More on Standards & Protocols Quality of Service. Week 10. College of Information Science and Engineering Ritsumeikan University

Unconstrained and Constrained Optimization

Call Stacks + On Writing Good Code

Stacks and Their Applications

CS 240 Fall Mike Lam, Professor. Priority Queues and Heaps

Cross-validation for detecting and preventing overfitting

1 P age DS & OOPS / UNIT II

What is Multicasting? Multicasting Fundamentals. Unicast Transmission. Agenda. L70 - Multicasting Fundamentals. L70 - Multicasting Fundamentals

CS 3516: Advanced Computer Networks

Computer Networks. Instructor: Niklas Carlsson

Homework 2: IP Due: 11:59 PM, Oct 19, 2017

CS164 Final Exam Winter 2013

Unit 28 Website Production ASSIGNMENT 1

ECE 573 Midterm 1 September 29, 2009

! Mon, May 5, 2:00PM to 4:30PM. ! Closed book, closed notes, clean desk. ! Comprehensive (covers entire course) ! 30% of your final grade

NAT, IPv6, & UDP CS640, Announcements Assignment #3 released

Appendix A.6 Functions

E3-E4 CM TECHNICAL IT INFRASTRUCTURE

Lecture 05 Application Layer - I

ES623 Networked Embedded Systems

Simple example. Analysis of programs with pointers. Program model. Points-to relation

Fault-Tolerant Computing

Algorithms and Data Structures

Transport Layer TCP & UDP Week 7. Module : Computer Networks Lecturers : Lucy White Office : 324

Lecture 2 8/24/18. Computer Memory. Computer Memory. Goals for today. Computer Memory. Computer Memory. Variables Assignment Sequential Steps

ARTIFICIAL INTELLIGENCE (CSC9YE ) LECTURES 2 AND 3: PROBLEM SOLVING

CSE/EE 461 Lecture 13 Connections and Fragmentation. TCP Connection Management

Class Overview. Introduction to Artificial Intelligence COMP 3501 / COMP Lecture 2. Problem Solving Agents. Problem Solving Agents: Assumptions

Rui Wang, Assistant professor Dept. of Information and Communication Tongji University.

Lecture 17 Notes Priority Queues

Implicit differentiation

Transcription:

Sorting Networks Lecture in E Freshman Seminar Series: Ten Puzzling Problems in omputer Engineering Ma 7 Sorting Networks Slide

bout This Presentation This presentation belongs to the lecture series entitled Ten Puzzling Problems in omputer Engineering, devised for a ten-week, one-unit, freshman seminar course b ehrooz Parhami, Professor of omputer Engineering at Universit of alifornia, Santa arbara The material can be used freel in teaching and other educational settings Unauthorized uses, including an use for financial gain, are prohibited ehrooz Parhami Edition Released Revised Revised First Ma 7 Ma 7 Sorting Networks Slide

Railroad Tracks and Switches Ma 7 Sorting Networks Slide

Railroad Yards Have Man Tracks and Switches Ma 7 Sorting Networks Slide

Rearranging Trains Train cars Engine Track D Sorted order D Stub or lead D Stub or lead D Stack or LIFO data structure in E Stub or lead D Question: Is there an ordering that cannot be sorted using a stub? nswer: Yes, if engine muse do the moving Sorting algorithm D Queue or FIFO Siding Ma 7 Sorting Networks Slide

Rearrangement with hange of Direction D Turnaround loop D D What tpes of sorting are possible with a turnaround loop? we? We onfiguration after the first few steps in sorting the train D omplete the sorting process, assuming that it is oka for the engine to end up behind the train Ma 7 Sorting Networks Slide 6

Delivering Train ars in a Specific Order ars in the train below have been sorted according to their deliver points However, it is still nontrivial to deposit car in stub, car in stub, and car in siding ars can be pulled or pushed b the engine D D Is there a better initial ordering of the cars for the deliveries in this puzzle? D Ma 7 Sorting Networks Slide 7

Train Passing Puzzle The trains below must pass each other using a siding that can hold onl one car or one engine Show how this can be done Ma 7 Sorting Networks Slide 8

Fast ombining or Reordering of Train ars D Forming multiple trains from incoming cars D Train reordering via a set of stubs ars are pushed or pulled b an engine lternativel, movement in one direction ma be achieved via sloped rails Switches used to be adjusted manuall, but nowadas, electronic control is used Ma 7 Sorting Networks Slide 9

Target track Sorting Train ars in Parallel Unconditional echange ompare-echange Track Track Track Track Track Track Track Track The net in stick diagram schematic Is adding this compare-echange element sufficient for producing a valid sorting network? Ma 7 Sorting Networks Slide

a b c d Validating a Sorting Network min(a, b) min(a, b, c, d) ma(a, b)???? min(c, d)???? ma(c, d) ma(a, b, c, d) Track Track Track Track In the eample above, it was fairl eas to show the validit of the sorting network Generall, it is much more difficult Stick diagram schematic How would one establish the validit of this 6-input sorting net? More importantl, how does one come up with this design in the first place? Ma 7 Sorting Networks Slide

Ma 7 Sorting Networks Slide The Zero-One Principle So, we can validate a sorting network using n rather than n! input patterns sorting net built of comparators is valid if it correctl sorts all - sequences n = : n = 96, n! = 79,,6 (thousands vs half a billion)

8 6 7 9 6-Input Sorting Network Use -input sorters, follow b (, )-mergers, and end with an (8, 8)-merger 8 6 7 9 6 7 8 9 Using the - principle, we can validate this network via 6 + + 8 tests 6 7 8 9 -sorter tests (, )-merger tests (8, 8)-merger tests Ma 7 Sorting Networks Slide

Ma 7 Sorting Networks Slide Insertion Sort and Selection Sort Fig 78 Sorting network based on insertion sort or selection sort (n )-sorter n n n n (n )-sorter n n n n Insertion sort Selection sort Parallel insertion sort = Parallel selection sort = Parallel bubble sort! (n) = n(n )/ D(n ) = n ost Dela = Θ(n ) Insertion sort Selection sort

The est Sorting Networks n = 6, modules, levels Which -input sorting network is better? n = 9, modules, 8 levels n =, 9 modules, 9 levels n =, modules, 7 levels ost = 9 Dela = 9 ost = Dela = 7 ost Dela = 9 9 = 6 ost Dela = 7 = 7 riterion : The number of sticks or compare-echange blocks (cost) riterion : The number of compare-echanges in sequence (dela) riterion : The product of cost and dela (cost-effectiveness) n =, modules, 8 levels The most cost-effective n-input sorting network ma be n = 6, 6 modules, 9 levels neither the fastest design, nor the lowest-cost design n = 6, 6 modules, levels Ma 7 Sorting Networks Slide

Electronic Sorting Networks Electronic sorting networks are built of -sorters, building blocks that can sort two inputs a min(a, b) b ma(a, b) pplications of sorting networks: Directing information packets to their destinations in a network router onnecting n processors to n memor modules in a parallel computer Ma 7 Sorting Networks Slide 6