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
___________ key encryption in wep uses the rc4 encryption algorithm.
lora16 [44]

Shared key encryption in wep uses the rc4 encryption algorithm.

7 0
2 years ago
Best way to build a model bridge
DanielleElmas [232]
Personally, i would use a 3-D printer, but you can use any material that you have, and have an example next to you for reference if you aren't going to 3-D print.

7 0
3 years ago
Read 2 more answers
According to your textbook, the three major criteria against which to test documents that you locate on the Internet are authors
pantera1 [17]

Answer:

The following statement is False.

Explanation:

Because asper textbook there are only one main criteria against the test documents that find on the internet i.e., authorship. So, that's why the following given statement is false. The graphic and the interactivity depends on the quality of the document this options do not come under the criteria to test the document.

6 0
3 years ago
What are some of the challenges that could arise from setting up a file management system on a computer?
son4ous [18]
It could glitch out or be hacked or deleted.
8 0
3 years ago
The pseudoinstructions that are available in an assembly language programming environment usually found in the Select one: a. CP
mafiozo [28]

Answer:

b

Explanation:

CPU manual provides guides to use a CPU.

Assembler manual provides guide on how to use an assembler and so is the case for compiler.

For a particular machine, it set of instructinos are available with the programmer.

6 0
2 years ago
Other questions:
  • Please look at picture
    10·2 answers
  • Given a int variable named yesCount and another int variable named noCount and a char variable named response, write the necessa
    9·1 answer
  • 6. While using the HTS, ________________ will help maintain a safe driving environment despite high speeds and a large number of
    12·1 answer
  • Manuel has set up his network so that some employees can open and view files but are unable to edit them. Others can open, view,
    10·1 answer
  • What are some hazards of being an astronomer??
    6·1 answer
  • Jack lost all the data he saved on his desktop because of a power outage while working on a presentation. On which of these comp
    15·2 answers
  • From Blown to Bits why is it important to know what children are doing on the Web Tonight?
    7·1 answer
  • which term describes the layer of software that resides between the virtual operating system and the physical hardware it runs o
    5·1 answer
  • A form of segmentation that is based on user usage rate, user status, purchase occasion, and benefits sought is _________.
    13·1 answer
  • What is the difference between
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!