Code segment , Computer Engineering

Assignment Help:

Specified  the code segment below and that n is the problem size, answer the following queries:

 

// . . .

int sum = 0;

if(x > 12){

for(int i = 1; i <= n; i = i * 2)
    for( intk = 0; k< n * n; k++)
        sum++;                        // statement1

}

else{

 

for(int i = 1; i <=n; i++)
           sum++;                          // statement2

}

 

 

for(int i = 1; i <= n; i = i +4)
    sum++;                                 // statement3

 

for(int i = 1; i <= n; i++)
    for( intk = 1; k<= n; k = k * 2)
        sum++;                              // statement4

 

  1. Determine the exact number of times statement1, statement2, statement3 and statement4 get implemented.
  2. Explain the Big-Q complexity of this program fragment in the best case. You must display the details of your computations and state the Big-Qrules that are used in the computations.
  3. Explain the Big-Q complexity of this program fragment in the worst case. You must display the details of your computations and state the Big-Q rules that are used in the computations.

 

 


Related Discussions:- Code segment

What is the future of hyper threading, Q. What is the Future of Hyper threa...

Q. What is the Future of Hyper threading? Current Pentium 4 based MPUs employ Hyper-threading however next-generation cores, Conroe, Merom and Woodcrest will not. As some have

DSP, Assignment of Analog to digital Ssignal Processing

Assignment of Analog to digital Ssignal Processing

What is the future in mq if i have 2+exp, It speeds execution of distribute...

It speeds execution of distributed applications. It runs on dissimilar platforms. It time independent. No loss for msg delivery i.e. guarantee delivery.

How the information should be retrieved from the database, In a report with...

In a report with an LDB attribute, you do not have to explain how the information should be retrieved from the database tables, but only how the data should be shown on the screen.

Artificial intelligence agents, Artificial Intelligence Agents: We int...

Artificial Intelligence Agents: We introduced what we'll be conversation about in Artificial Intelligence and why those things are necessary. This discussion is of course abou

Evaluation functions, Evaluation Functions: Evaluation functions calcu...

Evaluation Functions: Evaluation functions calculate approximately the score which can be prove of guaranteed if a particular world state is reached. Same like in chess, evalu

Software, S oftware In 1970s less than 1 percent of the public could h...

S oftware In 1970s less than 1 percent of the public could have intelligently explained what "computer software " means. Nowadays most professionals and various member of the

Control section in computer system, CONTROL SECTION: The control sectio...

CONTROL SECTION: The control section directs the flow of traffic (operations) and data. Also it maintains order within the computer. The control section chooses one program sta

Unification algorithm - artificial intelligence, Unification Algorithm - Ar...

Unification Algorithm - Artificial intelligence: To merge two statements, we should get a substitution which forms the two sentences similar. Remember that we write V/T to sign

When a network uses a star topology, A Network uses a star topology if? ...

A Network uses a star topology if? A Network utilizes a star topology if all computers attach to a single central point.

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