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
Natali5045456 [20]
3 years ago
5

Give a big-O estimate for the number of operations,

Computers and Technology
1 answer:
Kazeer [188]3 years ago
6 0

Answer:

Explanation:

For the first iteration of i for loop 1 to n, the j for loop will run from 2 to n times. i.e. n-1 times.

For the second iteration of i for loop, the j for loop will run from 3 to n times. i.e. n-2 times.

From the third to the last iteration of i for loop, the j for loop will run n-1 to n times. i.e. 2 times.

From the second to the last iteration of i for loop, the j for loop will run from n to n times. i.e. 1 time.

For the last iteration of i for loop, the j for loop will run 0 times because i+1 >n.

Hence the equation looks like below:

1 + 2 + 3 + ...... + (n-2) + (n-1) = n(n-1)/2

So the number of total iterations is n(n-1)/2.

There are two operations per loop, i.e. Comparison and Multiplication, so the iteration is 2 * n(n-1)/2 = n ^2 - n

So f(n) = n ^ 2 - n

f(n) <= n ^ 2 for n > 1

Hence, The algorithm is O(n^2) with C = 1 and k = 1.

You might be interested in
What is the name of the virus that appears to be a legitimate program?
timurjin [86]
A virus or malware appearing/pretending to be a legitimate program is called a Trojan. 
3 0
3 years ago
Which type of computer are todays most widely used personal computers?
iris [78.8K]

Answer:

Windows 10. :)

Explanation:

8 0
3 years ago
Read 2 more answers
Chất xơ có nhiều trong thực phẩm nào?
mezya [45]

Answer: rau củ quả đều có lượng chất xơ nhiều hơn so với các loại thực phẩn khác

Explanation:

3 0
2 years ago
How to check if your computer has bluetooth?
Lelu [443]
Assuming you're running Windows, click the start button, and then search for "Device Manager" (or open CMD or PowerShell and type devmgmt.msc). Look at the list of devices. If Bluetooth is there, you have it; if it's not there, you don't. 
5 0
2 years ago
Which type of address is used on the Transport Layer of the OSI Model to identify the receiving application?
Marianna [84]

Answer:

Port Number

Explanation:

In the transport Layer of the OSI Model the port number is used to identify the receiving application. Temporary communication sessions are set up that enable data exchange, the two protocols used are Transmission Control Protocol(TCP) and the User Datagram Protocol(UDP) . Each port is assigned a number that identifies it according to its function. The range for some well-known ports is 0-1023.

5 0
3 years ago
Other questions:
  • When introducing new devices to the network, the organization's security policy requires that devices be monitored to establish
    15·1 answer
  • What are issues to consider when deciding to build software in-house or purchase commercial off-the-shelf software (cots)?
    14·1 answer
  • Which sign or symbol will you use to lock cells for absolute cell reference
    5·1 answer
  • This loop is a good choice when you know how many times you want the loop to iterate in advance of entering the loop.
    14·2 answers
  • Which can be used to decode a Unicode character encoding into text?
    13·1 answer
  • What is the function of the kernel of an operating system? It is an application that allows the initial configuration of a Cisco
    7·1 answer
  • The NVCC college professor receives frequent emails disguised as official business emails. They may be requests to reset a passw
    10·2 answers
  • You have a small business.Due to the recent pandemic you seem to be losing contacts with your suppliers and customers.You want t
    10·1 answer
  • What does the coding phase involve?
    11·2 answers
  • PowerPoint is best described as:
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!