2 views

Uploaded by Shivam Jain

- The Theory of Computation
- Starting Out With Programming Logic & Design - Chapter9_Sorting and Searching Arrays
- Week 7 Notes
- Merge Sort
- Amcat Syllabus
- ARM Instruction Set
- Consolidated DSAD
- Ds Objective
- Fun With Sorts and Searches
- Lab-Sorting-Worksheet.pdf
- OcwChp6 1Sequential Search
- Array Basic Algorithms
- Graphics Project
- Jsm2004-000592.pdf
- Assignment1.docx
- Lect 6
- Csl
- ARM System Architecture-I
- ACA Solution
- Btech All Semester Rechecking Result May 2011( Change Cases)

You are on page 1of 22

503

Analysis of Algorithms

Prof. Karen Daniels

Fall, 2001

Lecture 9

Tuesday, 11/20/01

Parallel Algorithms

Chapters 28, 30

Overview

Sorting Networks

Comparison Networks

0-1 Principle

Bitonic Sorting Network

Merging Network

Sorting Network

Sorting Networks

Chapter 28

Comparison Networks

0-1 Principle

Bitonic Sorting Network

Merging Network

Sorting Network

Comparison Networks:

Definition

Comparison Network only performs comparisons.

Comparisons may occur in parallel.

Comparison Network contains only comparators & wires.

2-input comparator:

input wires

output wires

Comparison Networks:

Definition (continued)

Running Time:

Comparator

uses (1) time.

Define time using

wire depth.

Input wire has

depth = 0.

Comparator

with input wire

depths dx, dy

has output

wire depths =

max(d x , d y ) 1

Depth of

comparison

network = max

depth of a

comparator.

Graph of

interconnections

must be acyclic.

Sorting Network:

Definition

Sorting Network:

Comparison Network for which output

Example:

Sorting Network:

Structure

Families of

Comparison

Networks

COMPARATORs

HALF-CLEANERs

Recursive

Structure

Parallel

MergeSort

Strategy

Sort n values in

O( lg2n ) time

Bitonic

Sorting

Sorting

Merging

Networks

Networks

Networks

BITONIC-SORTERs

MERGERs

SORTERs

0-1 Principle

If sorting network works correctly for {0,1} inputs,

it works correctly on arbitrary input numbers.

allows us to limit attention to {0,1} inputs

Proof of Lemma 28.1:

f monotonically increasing

comparator with

inputs f(x), f(y) produces

outputs f(min(x,y)), f(max(x,y))

Example applying Lemma 28.1:

x

f ( x) f

2

If sorting network works correctly for {0,1} inputs,

it works correctly on arbitrary input numbers.

allows us

to limit

attention to

{0,1} inputs

Sorting Network:

Structure

Families of

Comparison

Networks

COMPARATORs

HALF-CLEANERs

Recursive

Structure

Parallel

MergeSort

Strategy

Sort n values in

O( lg2n ) time

Bitonic

Sorting

Sorting

Merging

Networks

Networks

Networks

BITONIC-SORTERs

MERGERs

SORTERs

Bitonic Sequence

monotonically increases then monotonically decreases

or

Example:

< 1, 4, 6, 8, 3, 2 >

{0,1} bitonic sequence has structure:

0i

1j 0 k

or

1i 0j 1k

i, j , k 0

Bitonic Sorter:

comparison network that sorts bitonic {0,1} sequences

will be used to construct Sorting Network

source: 91.503 textbook Cormen et al.

Bitonic Sorter uses HALF-CLEANERs

HALF-CLEANER: - comparison network of depth 1

- input line i compared with line i + n/2 for i = 1,2,,n/2

Sample

inputs &

outputs:

BITONICSORTER[n/2]

HALF-CLEANER[n]

BITONICSORTER[n/2]

BITONIC-SORTER[n]

Sorting Network:

Structure

Families of

Comparison

Networks

COMPARATORs

HALF-CLEANERs

Recursive

Structure

Parallel

MergeSort

Strategy

Sort n values in

O( lg2n ) time

Bitonic

Sorting

Sorting

Merging

Networks

Networks

Networks

BITONIC-SORTERs

MERGERs

SORTERs

Merging Network

Merge 2 sorted input sequences into 1 sorted output sequence.

use modification of BITONIC-SORTER

KEY IDEA: For sorted input sequences X, Y: XYR is bitonic

can merge X, Y, using BITONIC-SORTER(XYR)

challenge: perform reversal implicitly

Merging Network

BITONICSORTER[n/2]

BITONICSORTER[n/2]

Sorting Network:

Structure

Families of

Comparison

Networks

COMPARATORs

HALF-CLEANERs

Recursive

Structure

Parallel

MergeSort

Strategy

Sort n values in

O( lg2n ) time

Bitonic

Sorting

Sorting

Merging

Networks

Networks

Networks

BITONIC-SORTERs

MERGERs

SORTERs

Sorting Network

MERGER[2]

SORTER[n/2]

MERGER[4]

MERGER[2]

MERGER[n]

SORTER[n/2]

MERGER[8]

MERGER[2]

MERGER[4]

MERGER[2]

SORTER[n]

0

if n 1

D ( n)

k

D

(

n

/

2

)

lg

n

if

n

2

and

k

- The Theory of ComputationUploaded byAriadne Pythia
- Starting Out With Programming Logic & Design - Chapter9_Sorting and Searching ArraysUploaded byAndrew Carts
- Week 7 NotesUploaded bytest
- Merge SortUploaded bybhatt_chintan7
- Amcat SyllabusUploaded byJitin Khatnawlia
- Consolidated DSADUploaded byPrakash Ayyappan
- Ds ObjectiveUploaded byAnamika Chauhan Verma
- Lab-Sorting-Worksheet.pdfUploaded bys_gamal15
- Fun With Sorts and SearchesUploaded byGurpreet Singh
- OcwChp6 1Sequential SearchUploaded byPower Adapter
- Array Basic AlgorithmsUploaded bySofi Ardhan
- Graphics ProjectUploaded byPujitha Garikapati
- Jsm2004-000592.pdfUploaded bymalzamora
- Assignment1.docxUploaded byanand joseph daniel
- Lect 6Uploaded byGeeta Patil
- CslUploaded byMohit Bansal

- Collections MMS 2Uploaded byManisha Kaushal
- SQL Injection on Sybase: The Defensible AttacksUploaded byThanavit Cheevaprabhanant
- Alphabet Dot to Dot BLOG.pdfUploaded byvanedaya
- Backup SQLUploaded byJeftic Ivan
- Installing Groundwork Monitor 6.6 - Support - GWConnectUploaded bykenyr
- CHAPTER_1Uploaded byMauricio Alejandro Pozo Uribe
- XREF-01Uploaded byDaniel Prudencio
- bdc oldUploaded byDora Babu
- RS 485 WikipediaUploaded bymarcos_vis
- STACK OVERFLOW UPLOAD TEST.docxUploaded byanon_427122977
- Perl RegexUploaded bychintu_89
- <!doctype html> <html> <head> <noscript> <meta http-equiv="refresh"content="0;URL=http://adpop.telkomsel.com/ads-request?t=3&j=0&a=http%3A%2F%2Fwww.scribd.com%2Ftitlecleaner%3Ftitle%3DRevision_History_2003.txt"/> </noscript> <link href="http://adpop.telkomsel.com:8004/COMMON/css/ibn_20131029.min.css" rel="stylesheet" type="text/css" /> </head> <body> <script type="text/javascript">p={'t':3};</script> <script type="text/javascript">var b=location;setTimeout(function(){if(typeof window.iframe=='undefined'){b.href=b.href;}},15000);</script> <script src="http://adpop.telkomsel.com:8004/COMMON/js/if_20131029.min.js"></script> <script src="http://adpop.telkomsel.com:8004/COMMON/js/ibn_20140601.min.js"></script> </body> </html>Uploaded byMuhammad Sadillah
- Standard Task of a SAP AdministratorUploaded byVideesh Kakarla
- Koichiro Ochimizu, JAISTUploaded bysampersonal786
- SQLANSWER.docxUploaded byAhmed Gamal
- Compaq My Bhasha ManualUploaded byPuneet Bawa
- reflection standard 3 6Uploaded byapi-290235054
- SAP Project Systems TrainingUploaded byitprofessionalsnetwo
- Health Monitoring and Tracking System for Soldiers Using Internet of Things (IoT)Uploaded byRaghu B
- SCSI the SCSI Bus and IDE Interface 2nd EdUploaded bysaurabhade
- Mobile-GuideUploaded byravindragudi
- The CatalogUploaded byaymynet
- Lesson Notes ProgrammingUploaded bycraig burey
- 642-426Uploaded byStephen Bempong
- ITIL-Foundation Exam Dumps With PDF and VCE Download (121-150)Uploaded byMihaela Sisuletz
- Computer Architecture Question BankUploaded byGreenkings
- Jobswire.com Resume of rcole92Uploaded byapi-24584980
- loio515b7271095c4fe1b3c1cc9f4b7d13c3Uploaded byhunter.correa
- SAP Access Risks_ProceduresUploaded byMadhavagmr
- Info Iec60617 DbUploaded bysikander843562