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
:P 80 points to spare so i guess its free!!!!!!
Naddik [55]

Answer:

Thank you! can i have brainliest please?

Explanation:

5 0
3 years ago
Read 2 more answers
Coordinate with
Lunna [17]

Answer:

First blank: producer

Second blank: Hairdressers

5 0
3 years ago
What tabs found in the Windows Task Manager dialog box
fredd [130]
The applications you have open, and some background processes.
7 0
3 years ago
Assume that we would like to expand the MIPS register file to 128 and keep the size of all other fields as in the original MPIS
garri49 [273]

Answer:

These changes has the ability to decrease the size of a program, it

can do so by going ahead to reduce the instances in which the register contents “spill” into other registers or memory, it also does so by allowing more complex operations to be implemented in one instruction as agianst requiring multiple instructions.

On the other hand they are likely able to increase the size of a program by requiring adding bits to the opcode and register fields, thereby increasing memory width

Explanation:

See answer

7 0
3 years ago
Read 2 more answers
If an occupation is projected to decline by 7% over the next 10 years, how would you rate the job outlook?
Helen [10]
Steady sounds like the best answer but that’s tough
5 0
3 years ago
Other questions:
  • ________ software provides a means of sharing, distributing, and searching through documents by converting them into a format th
    13·1 answer
  • The main parts of a lever are the....
    6·2 answers
  • What has information technology made piracy possible?
    14·1 answer
  • What is an online recommendation engine?
    12·1 answer
  • When dealing with a person who is behaving violently you should argue with them. A. False B. True
    5·1 answer
  • A network administrator is configuring the triggering mechanism for the network-based IPS by defining a pattern of web surfing a
    10·2 answers
  • Several NEC® sections contain the requirement to size conductors and overcurrent devices at 100 percent of the noncontinuous loa
    15·1 answer
  • Hilarious error messages
    10·2 answers
  • 1 pound is equivalent to how many grams?<br>A.463.59 grams<br>B.10 grams<br>C.59 grams<br>D.5 grams​
    8·2 answers
  • I need help NOW with my java script!! 1. What will the code below output to the console and why? const person = {
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!