subject

Formally prove that n^2 + n + 1 is in O(n^2).
Solution:
Let T(n) = n^2 + n + 1. Let f(n) = n^2.
Choose c = 3, and N = 1. Then, we know T(n) is in O(n^2) if we can prove
T(n) <= c f(n),
or equivalently, n^2 + n + 1 <= 3 n^2, for all n >= 1.
Is this inequality true? Well, for any n >= 1, we know that 1 <= n <= n^2.
Hence, all of the following are true:
1 <= n^2
n <= n^2
n^2 = n^2
Adding the left and right sides of these inequalities together, we have
n^2 + n + 1 <= 3 n^2, which completes the proof.

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 05:20
Write a program called assignment3 (saved in a file assignment3.java) that computes the greatest common divisor of two given integers. one of the oldest numerical algorithms was described by the greek mathematician, euclid, in 300 b.c. it is a simple but very e↵ective algorithm that computes the greatest common divisor of two given integers. for instance, given integers 24 and 18, the greatest common divisor is 6, because 6 is the largest integer that divides evenly into both 24 and 18. we will denote the greatest common divisor of x and y as gcd(x, y). the algorithm is based on the clever idea that the gcd(x, y) = gcd(x ! y, y) if x > = y and gcd(x, y) = gcd(x, y ! x) if x < y. the algorithm consists of a series of steps (loop iterations) where the “larger” integer is replaced by the di↵erence of the larger and smaller integer. this continues until the two values are equal. that is then the gcd.
Answers: 3
question
Computers and Technology, 23.06.2019 00:00
Which is the correct sequence of steps to set up a document in landscape orientation? a. select page setup from the file menu. then click the margins tab and select landscape. b. select page setup from the edit menu. then click the margins tab and select landscape. c. select page setup from the insert menu. then click the margins tab and select landscape. d. select page setup from the format menu. then click the margins tab and select landscape
Answers: 1
question
Computers and Technology, 23.06.2019 17:10
Ac++an of of pi. in , pi is by : pi = 4 – 4/3 + 4/5 – 4/7 + 4/9 - 4/11 + 4/13 - 4/15 + 4/17 . ., to pi (9 ). , if 5 to pi,be as : pi = 4 - 4/3 + 4/5 - 4/7 + 4/9 = 4 – 1. + 0.8 - 0. + 0. = 3.. atoofbe to pi?
Answers: 2
question
Computers and Technology, 24.06.2019 21:00
When replacing a thermostat or water pump, coolant drained from the cooling system should be
Answers: 1
You know the right answer?
Formally prove that n^2 + n + 1 is in O(n^2).
Solution:
Let T(n) = n^2 + n + 1. Let f(n)...
Questions
question
Social Studies, 01.08.2019 03:00
Questions on the website: 13722360