Odd-even transposition algorithem, Computer Networking

Assignment Help:

Algorithm: Odd-Even Transposition

//Input: N numbers that are in the unsorted form

//Assume that element bi is assigned to pi

for I=1 to N

{

If (I%2 != 0) //i.e Odd phase

{

For j=1,3,5,7,..................2*n/2-1

{

Apply compare-exchange (Pj, Pj+1) //Operation is executed in parallel

}

}

Else // Even phase

{

For j=2,4,6,8..................2*(n-1)/2-1

{

} I++

}

 Apply compare-exchange(Pj, Pj+1) //Operation is executed in parallel

}

Let us take an example and illustrate the odd-even transposition algorithm.

Analysis

The above algorithm needs one „for loop? starting from I=1 to N, i.e. N times and for every value of I, one „for loop? of J is implemented in parallel. Thus, the time difficulty of the algorithm is O (n) as there are total n phases and each phase executes either odd or even transposition in O(1) time.

2417_Example.png

                                                                             Example


Related Discussions:- Odd-even transposition algorithem

Distance vector and link-state protocol, What's the difference among distan...

What's the difference among distance vector and link-state protocol?

Types of ends in wan, There are two types of ends in WAN (1)DTE (DATA TE...

There are two types of ends in WAN (1)DTE (DATA TERMINAL EQUIPMENT) (2)DCE(DATA COMMUNICATION EQUIPMENT)

Internet mail access protocol - application layer, Internet  Mail Access P...

Internet  Mail Access Protocol Another  mail access  protocols  is internet  mail access  protocols  version 4 (  IMAP4). IMAP4 is  similar to POP3 but it  has more  feature

synchronization principles of parallel programming , In multiprocessing, v...

In multiprocessing, various processors have to to communicate with each other. Therefore, synchronisation is needed between them. The correctness and performance of parallel execut

Ieee report, http://cseweb.ucsd.edu/~savage/papers/CCS12Exploit.pdf

http://cseweb.ucsd.edu/~savage/papers/CCS12Exploit.pdf

Explain fddi media, FDDI Media FDDI signifies a 100 Mbps token-passing ...

FDDI Media FDDI signifies a 100 Mbps token-passing dual-ring LAN that uses a fiber-optic transmission medium. Even though it operates at faster speeds FDDI is similar to Tok

Program, i need the job to be done within 3days

i need the job to be done within 3days

Write examples of the transport layer, Example of transport layer are:- ...

Example of transport layer are:- a) TCP is connection oriented. b) UDP is connectionless

Horizontal scaling and vertical scaling, What is meant by horizontal scalin...

What is meant by horizontal scaling and vertical scaling? Ans) Horizontal scaling means adding or removing client workstations with only a small performance impact. Vertical

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd