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

Impact of information systems, What are the primary impacts of information ...

What are the primary impacts of information systems on an organization (employer, club, school, religious, etc..) for which you are familiar? What are the primary ways in which

Illustrate the following list of consideration of Laptop, Illustrate the fo...

Illustrate the following list of consideration of laptop computers The following is a list for consideration: -  The processor must consume as little power as possible thus

How can one decide this decimal position, Q. How can one decide this decima...

Q. How can one decide this decimal position? Decimal position can be signified by a position between flip-flops (storage cells in computer). However how can one decide this dec

Explain about the client/server computing, Explain about the Client/Server ...

Explain about the Client/Server Computing? Although there are different various configurations, various hardware and software platforms and even various network protocols into

Minimum possibility -minimax algorithm, Minimum possibility -minimax algori...

Minimum possibility -minimax algorithm: Finally, we want to put the scores on the top edges in the tree. So there is over again a choice. Whenever, in this case, we have to r

What is hashing, What is Hashing? Hashing: Hashing gives the direct acc...

What is Hashing? Hashing: Hashing gives the direct access of record from the file no matter where the record is in the file. This is possible with the help of a hashing functio

Explain the working of any one of centralized spc, Explain the working of a...

Explain the working of any one of centralized SPC? Standby mode of operation is the easiest of dual processor configuration operations. Usually, one processor is active and

What is radium utilized for, Q. What is radium utilized for? Answer:- ...

Q. What is radium utilized for? Answer:- Radium was previously used in self-luminous paints for nuclear panels, watches, clocks, aircraft switches and instrument dials. In

Environments -artificial intelligence, Environments: We have seen that...

Environments: We have seen that an agents intelligent should take into account certain information when it choose a rational action, including information from its sensors, in

IT PMP project managemnet., Identify at least eight milestones for this pro...

Identify at least eight milestones for this project. Write a one-page paper describing each milestone using the SMART criteria?

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