answer.
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
ozzi
2 years ago
12

Prove that f(n) = 20n3 + 10nlogn + 5 is O(n3)

Computers and Technology
1 answer:
sp2606 [1]2 years ago
7 0

Answer:

The proof is in the explanation

Explanation:

f(n) is O(n^{3}) if f(n) \leq cn^{3} for n \geq n_{0}.

So, basically, we have to solve the following inequality

f(n) \leq cn^{3}

20n^{3} + 10n\log{n} + 5 \leq cn^{3}

Dividing everything by n^{3} to simplify, we have

20 + \frac{10\log{n}}{n^{2}} + \frac{5}{n^{3}} \leq cn^{3}

I am going to use n = n_{0} = 1. So

20 + 5 \leq c

c \geq 25

There is a solution for the inequality, which proves that f(n) = 20n^{3} + 10n\log{n} + 5 is O(n^{3})

You might be interested in
Why would Network Systems employees be employed by the government?
Ghella [55]
Well knowing how the government is with security id go with A. as it makes a lot of sense unlike B and D and if they were looking for software the question would mention it
8 0
2 years ago
Read 2 more answers
Olivia creates a personal budget. She enters her current savings account balance in cell D3. In cell A3, she calculates her inco
alexdok [17]

Answer is :

=D3+A3-B3

These Cell address contain following statement:

D3= Olivia saving account balance

A3= Olivia 3 month income

B3= Olivia 3 month expense

so, Expense are also deducted from income and income is added into saving balance.

In this situation we are use this formula:

=D3+A3-B3

5 0
1 year ago
Assume the availability of class named IMath that provides a static method, toThePowerOf which accepts two int arguments and ret
geniusboy [140]

Answer:

cubeVolume = IMath.toThePowerOf(cubeSide, 3);

Explanation:

Following is the explanation for above statement:

Left side:

cubeVolume is a variable with data-type int, it will store the integer value that is the output from right side.

Right side:

  • IMath is the class name.
  • toThePowerOf is the built-in function that takes two arguments of data type int. First is the base and second is the power(exponent) separated by comma. In place of first argument that is the base variable we will pass the variable cubeSide that has been declared and initialize.
  • Now the output will be stored in the variable cubeVolume.

i hope it will help you!

4 0
2 years ago
Write a program FindDuplicate.java that reads n integer arguments from the command line into an integer array of length n, where
kozerog [31]

Answer:

  1. public class FindDuplicate{
  2.    public static void main(String[] args) {
  3.        Scanner input = new Scanner(System.in);
  4.        int n = 5;
  5.        int arr[] = new int[n];
  6.        for(int i=0; i < arr.length; i++){
  7.            int inputNum = input.nextInt();
  8.            if(inputNum >=1 && inputNum <=n) {
  9.                arr[i] = inputNum;
  10.            }
  11.        }
  12.        for(int j =0; j < arr.length; j++){
  13.            for(int k = 0; k < arr.length; k++){
  14.                if(j == k){
  15.                    continue;
  16.                }else{
  17.                    if(arr[j] == arr[k]){
  18.                        System.out.println("True");
  19.                        return;
  20.                    }
  21.                }
  22.            }
  23.        }
  24.        System.out.println("False");
  25.    }
  26. }

Explanation:

Firstly, create a Scanner object to get user input (Line 4).

Next, create an array with n-size (Line 7) and then create a for-loop to get user repeatedly enter an integer and assign the input value to the array (Line 9 - 14).

Next, create a double layer for-loop to check the each element in the array against the other elements to see if there is any duplication detected and display "True" (Line 21 - 22). If duplication is found the program will display True and terminate the whole program using return (Line 23). The condition set in Line 18 is to ensure the comparison is not between the same element.

If all the elements in the array are unique the if block (Line 21 - 23) won't run and it will proceed to Line 28 to display message "False".

7 0
1 year ago
A file named data.txt contains an unknown number of lines, each consisting of a single integer. Write some code that creates two
Damm [24]

Answer:

I am doing it with python.

Explanation:

nums = '9 -8 -7 -6 -5 -4 -2 0 1 5 9 6 7 4'

myfile = open('data.txt', 'w')

myfile.write(nums)

myfile.close()

myfile = open('data.txt', 'r')

num1 = (myfile.read())

num1 = num1.split()

print(num1)

print(type(num1))

for x in num1:

   x = int(x)

   if x < 0:

       minus = open('dataminus.txt', 'a')

       minus.write(str(x) + ' ')

       minus.close()

   elif x>= 0:

       plus = open('dataplus.txt', 'a')

       plus.write(str(x)+' ')

       plus.close()

3 0
2 years ago
Read 2 more answers
Other questions:
  • Which of the following is ideal for long distance communication ?
    5·1 answer
  • Write a program that prompts the user to enter the month and year and displays the number of days in the month. For example, if
    13·1 answer
  • In your own words, what is pair-programming? What is the role of the driver? What is the role of the navigator? What are some be
    15·1 answer
  • Which of the following statements is incorrect? An operating system provides an environment for the execution of programs. An op
    15·1 answer
  • 10. (P37) Compare GBN, SR, and TCP (no delayed ACK). Assume that the timeout values for all three protocols are sufficiently lon
    12·1 answer
  • Given main(), define the Team class (in file Team.java). For class method getWinPercentage(), the formula is:teamWins / (teamWin
    15·1 answer
  • While Angela is making modifications to Katie’s Word document, she would like to inform Katie of the reasoning for the change. W
    10·1 answer
  • Write a statement that assigns total_coins with the sum of nickel_count and dime_count. Sample output for 100 nickels and 200 di
    11·1 answer
  • Which option in the Caption dialog box configures whether the caption appears above or below the image
    11·2 answers
  • Doug grew up on a large farm in southwest Wisconsin. As a college graduation gift, Doug’s father gave him several hundred acres
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!