Odd-even transposition algorithem, Computer Networking

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

Posted Date: 3/2/2013 6:53:00 AM | Location : United States







Related Discussions:- Odd-even transposition algorithem, Assignment Help, Ask Question on Odd-even transposition algorithem, Get Answer, Expert's Help, Odd-even transposition algorithem Discussions

Write discussion on Odd-even transposition algorithem
Your posts are moderated
Related Questions
a)  A host is sending a HTTP request to a HTTP server. In the table below, propose a correct set of source and destination port numbers for segments sent from host to server and fr

Packet  Cost Both  distance vector and link  state  routing  are lowest  algorithms. Tow factors  govern  how  cost is applied to packets  in determines  a route. Cost  is a

Q. Explain the Types of Security Service? Security Services fall into one of the subsequent categories - Confidentiality: Confirms that the info in a system and transm



What is the implication of increasing and decreasing subnet Bits?

Define Co-axial cable. A solid central conductor surrounded by insulating material and then by a cylindrical shield woven from fine wires is called as co-axial cable. The shie

You are the network administrator for the City of Joshua Texas. The city government offices are located in five buildings separated by a State Highway controlled by the State of Te


Normal 0 false false false EN-IN X-NONE X-NONE MicrosoftInternetExplorer4