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

How to connect remote lans, Q. How to connect Remote LANs? - Remote br...

Q. How to connect Remote LANs? - Remote bridges acting as connecting devices to connect LANs and point-to-point networks such as leased telephone lines or ADSL lines

Show vpns security and the internet model, Q. Show VPNs Security and the In...

Q. Show VPNs Security and the Internet Model? - VPN's Security and the Internet Model - Application layer - provide for each application protocol (other layers may be left v

Describe about radio waves, Radio Waves - Frequency ranges: 3 KHz to 1...

Radio Waves - Frequency ranges: 3 KHz to 1 GHz - Omni directional - Susceptible to interference by other antennas utilizing same frequency or band - Ideal for long-di

Modify the tcp server and udp server in client server, Let's imagine that w...

Let's imagine that we have 2 TCP clients. A simple one (modTCPClient.c) like the one you wrote in the first part of project 2 and another one (modTCPClient1.c) that after it connec

What do you use the aux port for, The auxiliary port is used to link a mode...

The auxiliary port is used to link a modem to for dial backups.

Round trip time and time out - transport layer, Round Trip Time (RTT) and T...

Round Trip Time (RTT) and Time Out The  size and  the complexity  of computer  networks  have grown  in past years. To achieve  an efficient  and reliable transmission  some

Multithread web server, CSE4344 Computer Network Organization Project 1 Sim...

CSE4344 Computer Network Organization Project 1 Simple Web Server & Client Instructor: Sajib Datta Spring 2017 "What I cannot create, I do not understand." Richard P Feynman Object

Network Fundamentals BTech Telecommunication, Write a report on your chosen...

Write a report on your chosen topic that has been approved by your Lecturer. Your report should include appropriate figures, about 2000 words. Topics: 1 MAN- Metro Ethernet 2 Inte

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