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
zhuklara [117]
3 years ago
7

Give a big-O estimate for the number additions used in this segment of an algorithm.

Computers and Technology
1 answer:
rjkz [21]3 years ago
3 0
Big-O notation is a way to describe a function that represents the n amount of times a program/function needs to be executed. 

(I'm assuming that := is a typo and you mean just =, by the way) 

In your case, you have two loops, nested within each other, and both loop to n (inclusive, meaning, that you loop for when i or j is equal to n), and both loops iterate by 1 each loop.

This means that both loops will therefore execute an n amount of times. Now, if the loops were NOT nested, our big-O would be O(2n), because 2 loops would run an n amount of times.

HOWEVER, since the j-loop is nested within i-loop, the j-loop executes every time the i-loop <span>ITERATES. 
</span>
As previously mentioned, for every i-loop, there would be an n amount of executions. So if the i-loop is called an n amount of times by the j loop (which executes n times), the big-O notation would be O(n*n), or O(n^2). 

(tl;dr) In basic, it is O(n^2) because the loops are nested, meaning that the i-loop would be called n times, and for each iteration, it would call the j-loop n times, resulting in n*n runs.

A way to verify this is to write and test program the above. I sometimes find it easier to wrap my head around concepts after testing them myself.
You might be interested in
You have a user who takes his laptop home every day after work. When he's working in the office, the laptop must get an IP addre
maw [93]

Answer:

Alternate IP configuration

Explanation:

Based on the information provided within the question it can be said that the best method that can be used would be Alternate IP configuration. This is a feature that is implemented in most adapter's TCP/IP settings, which allows the individual computer to switch to a new and specific IP address that will allow that computer to communicate with various devices in the private network. This also allows the network adapter to pull the address that is needed from the DHCP server, such as the individual in this scenario needs.

3 0
3 years ago
Your employer gives you a list of all chemicals in the entire building and the location of the SDS collection, and he asks you t
stepladder [879]
Employers should familiarize themselves with the training requirements that apply to their employees and their business; design and implement effective training programs; and use qualified trainers. In addition, employers should thoroughly document all training activities, and should retain records of employee attendance at all completed trainings. Training records should include the name of the trained employee, the date of training, the type of training and the training provider. It is a best practice for employers to keep documentation of all trainings provided to demonstrate compliance with all applicable laws and regulations.
4 0
3 years ago
Read 2 more answers
A cover letter should simply restate what is included in your résumé.<br> True<br> False
stich3 [128]
True because all resumes need a cover letter

6 0
3 years ago
Read 2 more answers
Ayudaa, 5 ejes de sistemas tecnológicos
sashaice [31]

Answer:

support 5 axes of technological systems

Explanation:

4 0
3 years ago
Which two statements are true about algorithms?
DENIUS [597]

Answer:

I. Algorithms can be written using pseudocode.

II. Algorithms can be visualized using flowcharts.

Explanation:

An algorithm can be defined as a standard formula or procedures which comprises of set of finite steps or instructions for solving a problem on a computer. The time complexity is a measure of the amount of time required by an algorithm to run till its completion of the task with respect to the length of the input.

The two statements which are true about algorithms are;

I. Algorithms can be written using pseudocode. A pseudocode refers to the description of the steps contained in an algorithm using a plain or natural language.

II. Algorithms can be visualized using flowcharts. A flowchart can be defined as a graphical representation of an algorithm for a process or workflow.

Basically, a flowchart make use of standard symbols such as arrows, rectangle, diamond and an oval to graphically represent the steps associated with a system, process or workflow sequentially i.e from the beginning (start) to the end (finish).

3 0
3 years ago
Read 2 more answers
Other questions:
  • What device brocasts all data packets to other nodes on a network?
    5·1 answer
  • Once the technology for the collection of solar power is in place what will be two benefits of its use
    9·1 answer
  • The second row of letters on the keyboard is called the______ row
    14·2 answers
  • Python3
    7·1 answer
  • Write a java program to print the following series: <br>1 5 9 13 17...n terms​
    13·2 answers
  • How does it transform your ways of socializing
    11·1 answer
  • When writing code, how can printing be useful?
    15·1 answer
  • State two function of protein in the body
    8·1 answer
  • Login
    11·1 answer
  • I don't know if this is supposed to go here or art but i need help with photoshop, basically you can create whatever you want bu
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!