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

What are the two broad class classifications, What are the two broad class ...

What are the two broad class classifications under which Networks can be divided? All computer networks fit in one of the two dimensions namely: a)      Transmission Technol

Illustrate TCP – bytes and segments, Q. Illustrate TCP – bytes and segments...

Q. Illustrate TCP – bytes and segments? TCP - bytes & segments TCP at the sending site collects bytes into a packet called a segment TCP adds a header to each se

Define encoder, Define Encoder? A device or program that uses predefine...

Define Encoder? A device or program that uses predefined algorithms to encode, or compress audio or video data for storage or transmission use. A circuit that is used to change

How do you disable advanced editing, We can deactivate advanced editing us ...

We can deactivate advanced editing us using  terminal no editing

Authoritative dns servers application layer, Authoritative DNS Servers ...

Authoritative DNS Servers Every  organization with publicly  accessible hosts  ( such  as web  server and mail  several  on the  internet  must  provide  publicly accessible D

Determine the working of lan within a corporate network, Determine the work...

Determine the working of LAN within a corporate network It should be very clear right from the beginning that a firewall is not simply for protecting a corporate network from u

Intradomain and interdomain routing protocols?, Describe the concept of int...

Describe the concept of intradomain and interdomain routing protocols?

Network topology and design, Question 1: The following is a dump of a T...

Question 1: The following is a dump of a TCP header in hexadecimal format: 00CD0018 00000EF1 00000D5D 502200D1 01BF0010 Please answer the following two parts of questions

Describe the rpc and client server architecture, Can you describe the RPC a...

Can you describe the RPC and Client server Architecture?

Explain short message service, Question: (a) Short Message Service (SM...

Question: (a) Short Message Service (SMS) is a service available on most mobile phones that allows the sending of short messages between mobile phones, other handheld devices

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