1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
vladimir2022 [97]
3 years ago
8

Algorithmic Complexity: what is the asymptotic complexity (Big-O) of each code section? Identify the critical section of each.\

Line 1: for (int i=0; i<532; i++) { f(n) = O( ) Line 2: for (int j=1; j
Computers and Technology
1 answer:
AleksandrR [38]3 years ago
4 0

Answer:

Check the explanation

Explanation:

1) f(n) = O( 1 ), since the loops runs a constant number of times independent of any input size

there is no critical section in the code, as a critical section is some part of code which is shared by multiple threads or even processes to modify any shared variable.This code does not contain any variable which can be shared.

2) f(n) = O( log n! ), the outer loop runs for n times, and the inner loop runs log k times when i = k,ie the total number of print will be – log 1 + log2 +log3 +log4+…...+ log n = log (1 . 2 . 3 . 4 . ……. . n ) =log n!

there is no critical section in the code, as a critical section is some part of code which is shared by multiple threads or even processes to modify any shared variable.This code does not contain any variable which can be shared.

Note : Log (m *n) = Log m + Log n : this is property of logarithm

3) f(n) = O( n^2 ), since both outer and inner loop runs n times hence , the total iterations of print statement will be : n +n+n+…+n

for n times, this makes the complexity – n * n = n2

there is no critical section in the code, as a critical section is some part of code which is shared by multiple threads or even processes to modify any shared variable.This code does not contain any variable which can be shared.

You might be interested in
What is the benefit of making an archive folder visible in the Outlook folder list?
Rufina [12.5K]

Answer:

a

Explanation:

5 0
2 years ago
45 points pls help
Artemon [7]

Answer:

Repetition.

Explanation:

hope it helps u

can u mark me as brainliest

8 0
2 years ago
Read 2 more answers
The students of a college have to create their assignment reports using a word processing program. Some of the questions in thei
ser-zykov [4K]

Answer:

Table function

Explanation:

The table function can also be used to compare between items. The items can be arranged in columns and the features tonbe compared can be placed in columns. With this one can make comparison between the items.

5 0
2 years ago
The inflationary gap occurs when you obtain no increase in output, but only an increase in the Average Price Level from an incre
Dafna11 [192]
<span>B. Second phase of the Keynesian LRAS Curve.</span>
5 0
3 years ago
whats that system tool the rearranges files and unused space on the hard drive so programs can run faster
Zolol [24]
The Disk Fragmenter.
5 0
2 years ago
Read 2 more answers
Other questions:
  • When you sort a cell range using a to z or z to a, what is rearranged?
    5·1 answer
  • Software that was designed to serve the needs of a specific company or organization is called:
    5·1 answer
  • A blank is a link on a web page that leads to another web page.
    14·1 answer
  • Current versions of windows support file names up to ________ characters long
    5·1 answer
  • Asian-American men are often represented in the media as _____.
    8·2 answers
  • Nate wants to copy the style of his contact address to the normal template. Complete the paragraph to describe how he can access
    6·1 answer
  • ____ the styles allows the designer to start from a known baseline, confident that no unwanted styles will creep in from any bro
    6·1 answer
  • What can be the maximum possible length of an identifier 3163 79 can be of any length​
    5·1 answer
  • All the network nodes are connected to each other
    8·1 answer
  • What does Amara hope will<br> happen when Dad sits on the sofa?
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!