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
torisob [31]
4 years ago
10

Give a big-O estimate the number of operations, where an operation is a comparison or a multiplication, used in this segment of

an algorithm (ignoring comparisons used to test the conditions in the for loops, where a1, a2, . . . , an are positive real numbers)
Computers and Technology
1 answer:
ki77a [65]4 years ago
6 0

Answer and 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.

4) Suppose n = 1, then i = 2

n = 2, then i = 4

n = 3, then i = 6

n = 4, then i = 8

So the value of i is doubled for each iteration of while loop.

So i = 2 ^ n

i is growing at the rate of a power of 2, so the number of operations is log(2n)

Hence the algorithm is O(log(n)).

You might be interested in
Sometimes a database can contain "bad data," meaning incomplete, incorrect, inaccurate, or irrelevant records, which can be corr
sergey [27]

Answer:

True.

Explanation:

The database can contain "bad data".

Bad Data is incorrect,incomplete,irrelevant or inaccurate records and the bad data can only be corrected or by data cleansing.

Data cleansing is deleting the bad data from the database.It is very important technique which is implemented by almost every one dealing with bad data.

Hence we conclude that the answer to this question is True.

4 0
3 years ago
Which is the correct formula to add the values in cells A1 and B1? A. SUM(A1+B1) B. =SUM(A1+B1) C. =SUMA1+B1 D. A1+B1
galina1969 [7]
D I'd the answer to the problem
4 0
3 years ago
Read 2 more answers
What is the function of the NOS? Select all that apply.
Zigmanuir [339]

Answer:

.network management

Explanation:

pls need brainliest

3 0
3 years ago
Read 2 more answers
What's wrong with these codes in code HS Karel challenges(7.1.2. Racing Karel) Codes: //Below is the program that have Karel mov
Viktor [21]

Answer:

The program only runs 5 five since the for loop statement is limited to loop only five times.

Explanation:

In programming, a for-loop statement is used to repeat a collection of events a definite number of times. The number of loops is specified and compared with a variable to execute a block of code.

The for-loop statement in the code above declares and initializes a variable "i" to zero, runs the block of code, and increments by one if it is less than 5.

To make it run eight times, the value five should be changed to 8 instead.

5 0
3 years ago
During an investigation of a cybercrime, the law enforcement officers came across a computer that had the hard drive encrypted.
borishaifa [10]

Answer:

b. Try to convince the owner of the computer to give you to decryption key/password.

Explanation:

Encrypted hard drives have maximum security and high data protection. to access them you need to enter a password to unlock them.

The image filtering technique is a method that serves to selectively highlight information contained in an image, for which it does not work.

The encryption algorithm is a component used for the security of electronic data transport, not to access data on an encrypted hard drive.

The encryption key is used in encryption algorithms to transform a message and cannot be exposed by disconnecting the hard drive from its power source.

4 0
3 years ago
Other questions:
  • Oxygen-18 has an atomic number of 8. How many neutrons are in this isotope?
    7·1 answer
  • Which tab is used to edit objects on the slide master and layouts
    10·1 answer
  • Science is a body of knowledge that extends back to Select one: a. the time of Galileo. b. Italy in the 16th century. c. Greece
    6·1 answer
  • Write a function called printEvens that prints all the even numbers between 2 and 20, inclusive. It will take no arguments and r
    6·1 answer
  • Consider the following partial class definitions: public class A1 { public int x; private int y; protected int z; ... } public c
    12·1 answer
  • Write an expression to print each price in stock_prices. Sample output with inputs: 34.62 76.30 85.05
    9·1 answer
  • Which statement will properly start the main() function? def main(): def Main def main# def main[]
    14·2 answers
  • Victor works for a telemarketing company that is on a very tight budget. He has been tasked with finding a method for the compan
    7·2 answers
  • Why does computer uses 0s and 1s to procress data​
    7·2 answers
  • As a member of the help desk administration team, you've been assigned to update the driver for the network adapter that is inst
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!