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

Define IEEE 802.4-token bus, IEEE 802.4-Token bus Physical line or tree...

IEEE 802.4-Token bus Physical line or tree however logical ring. Stations know "left" as well as "right" stations. One token "passed" from station to station. Only station with

Application layer , Normal 0 false false false EN-IN ...

Normal 0 false false false EN-IN X-NONE X-NONE Application Layer   The application  layer

Explain the Physical layer, Explain the Physical layer The Physical lay...

Explain the Physical layer The Physical layer of the OSI model sets standards for sending and receiving electrical signals among devices. It explains how digital data (bits) ar

Protocols are used for logical network addressing, Which of the following p...

Which of the following protocols are used for logical network addressing? Ans) Internet Protocol - IP gives routing and a one interface to the upper layers. No upper layer proto

Explain the lan topologies, LAN Topologies The term topology explains t...

LAN Topologies The term topology explains the geographic arrangement of networking devices. It explains the actual layout of the network hardware. Given the location of worksta

Define poison reverse, By entering a 16 as the hop count, the other routers...

By entering a 16 as the hop count, the other routers recognize that the destination is unreachable.

Telecoms, What is a Multiplexor

What is a Multiplexor

Mechanical characteristics of RS232 interface, Q. Mechanical Characteristic...

Q. Mechanical Characteristics of RS232 interface? - 9-pin connector - 9-pin connector is more usually found in IBM-PC but it covers signals for asynchronous serial com

Explain the term- bits and bitmap, Explain teh term- Bits and Bitmap ...

Explain teh term- Bits and Bitmap Many tiny dots, which are put together to make a picture. Bits are combined to make a graphic image called a bitmap. GIF and JPEG files are

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