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

Command to view the configuration-register value, Recognize the command to ...

Recognize the command to view the configuration-register value Ans) show version is the command to view the configuration-register value

What is encapsulation and de-encapsulation, Process to send data is called ...

Process to send data is called as encapsulation and process to receive data is called De-encapsulation.

Explain the types of security threats, Q. Explain the types of Security Thr...

Q. Explain the types of Security Threats? (a) Normal Flow (b) Interruption: An asset of a system develops into unavailable or unusable. (c) Interception: A few unaut

Determine the connection to backbone lan, Connection to backbone LAN In...

Connection to backbone LAN In most cases, interconnection with stations on a wired backbone LAN is needed. For infrastructure wireless LANs, this is simply accomplished by the

Network analyzers, NETWORK ANALYZERS: A network analyzer also known ne...

NETWORK ANALYZERS: A network analyzer also known network monitor or a network sniffer is used to calculate the performance of or debug a network. It may report statistics s

frames along with the rtp, For VOIP, first you need to consider the codec ...

For VOIP, first you need to consider the codec to use. Although there are many voice codecs, MyCo wants the safest bet and suggests that you design with the most known and oldest c

Primary function - computer network, Primary Function Core network ty...

Primary Function Core network typically providing  the followings functionality 1.Aggregation : the  highest  level  of aggregation  in a service  provider  networks. The

How l2f establishes the tunnel, Can you describe the broader steps of how L...

Can you describe the broader steps of how L2F establishes the tunnel?

What are all the base services provided by the os, What are all the Base se...

What are all the Base services provided by the OS? Interprocess communications (IPC) Task preemption Task priority Local/Remote Interprocess communication Semaphor

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