Big-Oh proof feedback [closed] - algorithm

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 5 years ago.
Improve this question
I'm currently reading about Big-Oh and the way to prove the statements.
However, I need a feedback or just direction for proving.
So, I want to prove that for all real numbers a and b,
if b > a and a > 1, then b^n not in O(a^n).
I want to prove by contradiction, since b>a. Let b^n be in O(a^n), then
by definition of Big-oh, there is a constant c and natural number n0, such
that b^n <= ca^n, for all n >= n0. Thus n > max(n0, c) which is
contradiction.
I'm little bit lost and my last sentence, and looking for some feedback if it's possible.

The conclusion follows pretty closely from the definitions you've given, so the proof is not much more than you're already written. You need to get:
b^n ∈ O(a^n) ⇒ ∃ c,n0 : (b/a)^n < c for all n > n0
and
b > a > 1 ⇒ (b/a) > 1, and (b/a)^n grows without bound.
If you actually want to construct a contradiction you can show that for any c > 0, you can choose n > log(c) / log(b/a)

Related

Why is only one of the given statements about complexity classes correct? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
Apparently the correct answer to the following question is (C), but why are the other options not correct until we know the value of n?
If n=1, all of these seem correct except (B)! Where am I going wrong?
Which of the following is not O(n2)?
(A) 1510 * n + 12099
(B) n1.98
(C) n3 / √n
(D) 220 * n
Wikipedia says :-
Big O
notation describes the limiting behavior of a function when the
argument tends towards a particular value or infinity, usually in
terms of simpler functions. A description of a function in terms of big O notation usually only
provides an upper bound on the growth rate of the function.
An upper bound means that f(n) = n can be expressed as O(n), O(n2), O(n3), and others but not in other functions like O(1), O(log n).
So, going in the same direction, now you can easily eliminate options as shown below :-
1510 * n + 12099 < c * n2, for some n > √12100 i.e. n > 110 --- hence is O(n2).
n1.98 < n2, for all n > 1 --- and is O(n2).
n3 / √n = n5/2 > n2 for all n > 1 --- hence, isn't O(n2).
220 * n = 1024*1024*n < c* n2 for all n > 1 ,where c = 1024*1024 --- hence, is O(n2).
Hence, the only option which doesn't satisfy O(n2) is option C,i.e., f(n) = (n^3 / (sqrt(n))). Here, so, (n3 / (sqrt(n))) isn't equal to O(n2).
While Shekhar Suman’s answer explains why the official answer is right in each case, it does not answer this part of the question: “Apparently the correct answer to the following question is (C), but why are the other options not correct until we know the value of n? If n = 1, all of these seem correct except (B)! Where am I going wrong?” (my highlighting).
I would suggest that the first two parts I have put in bold indicate what the questioner – at the time of asking – had not grasped, namely that O-notation is used to express information about functions, not about particular values of expressions.
This means it makes no sense to say “If n = 1, f(n) is O(n2)”, as that is a statement about one value, f(1), and not about the function f.
Similarly, “until we know the value of n” makes no sense when talking about functions, because n is a bound variable, i.e. is only used to relate n to an expression involving n in order to define a function.
None of the options are of order n^2.
(15^10) * n + 12099 is of order n
n^1.98 is of order n^1.98
n^3 / (sqrt(n)) is of order n^2.5
(2^20) * n is of order n
You can check whether two functions are of the same order, by dividing one over the other. It should tend to go to a constant when n goes to infinity.

Modulo equation, retrieve K from d [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 8 years ago.
Improve this question
Here's an equation:
d is the multiple inverse of 3 modulo K.
Assuming I have d, can I find K?
Also, K is not necessarily prime.
Thanks!
You know that
d*3 = 1 (mod K)
this means
d*3 = 1 + n*K
independently of K this however means
d*3 = 1 (mod n)
i.e. that d is the inverse of 3 modulo n too, thus the answer is in general not unique (actually you can use any divisor of nK as answer).

Expectation of the Sum of K Numbers [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 9 years ago.
Improve this question
I am working on a histogram problem, and then I ran into the following math problem:
Given N numbers, where the value of each number is different, denoted as v1, v2, ..., vn, and the probability of selecting each number is p1, p2, ..., pn, respectively.
Now if I select K numbers based on the given probabilities, where K <= N, what is the expectation of the sum of those K numbers? Note that the selection is without replacement, so that the K numbers cannot involve duplicate numbers. I understand that if the selection is with replacement, the expectation of the sum of the K numbers equals K * E(V), where E(V) = v1*p1 + v2*p2 + ... + vn*p2.
Furthermore, what about the expectation of the variance of those K numbers?
This question is better formulated at here.

How to find complexity of a recursion where the step is defined in terms of a cube root? [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
T(1) = 1
T(n) = T(n^1/3) + 1
How can I solve it? By "solve" I mean to found it's "complexity" (I don't really know how to say it in English), such as O(nlogn) ecc.
I couldn't guess the substitution method; i go nowhere with the iteration method, and I can't apply Master Theorem.
I'm arrived here, but I'm not sure:
T(n) = T(n^(1/3^k))) +k
Can you give me and advice please?
I'll try to formulate some possible solutions. You can pick one depending on further constraints.
The recursion will run until n becomes 1. This is:
1 = n^(1/3^k)
or more generally
b = n^(1/3^k)
where k is the recursion depth. Solving this for k yields:
ln(b) = 1/3^k * ln(n)
ln(ln(b) / ln(n)) = k * ln(1/3)
-ln(ln(b) / ln(n)) / ln(3) = k
If we set b to 1, then the equation becomes unsolvable, because ln(0) is not specified. This would be equivalent to an endless recursion.
However, we can say that in the last recursion n should be "roughly 1". So we actually have a b != 1. Then k is:
k = -ln(ln(b) / ln(n)) / ln(3)
= -ln(c1 / ln(n)) / c2
= -(ln(c1) - lnln(n)) / c2
= (-c3 + lnln(n)) / c2
This should be O(log log n).
If you want to truncate n to its integer part, the calculation becomes pretty messy, because you have special cases after each step. However, we could approximate the result by specifying b = 1.999999. This would yield the same complexity as above.
If this is a recursive function, so what i did understand is that
T(n)= T(integerpart(cubicsquare(n)) +1 ;
in this case :
S=0;
if (n>=1){
S++;
N= n;
while (N>1){
N=integerpart(N^1/3);
S++;
}
}
T(n)= S ;
that's mean that T(n) is a simple function : with integer bound, and the width of the keme interval is 2^(3^k) - 2^(3^(k-1))
you can see, first interval is if n in ]1,8[ T(n)=2; then if n in [8,252[ ,T(n)=3...
so, as we can say then that t(2^(3^k)) = k+1 ;
then t(n) ~O(ln(ln(n))/ln(3)) (consider suite 2^3^k)

How to represent the max power possible [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 8 years ago.
Improve this question
Kind of a math question, but very programming related. Doing some Big-O problems and I have an algorithm where a for loop will run n times, where k = input size, n = max power of 4 where (k)/(4^n) >= 1. How can I represent max power of 4 where (k)/(4^n) >= 1 in one mathematic statement?
floor ( (log k)/(log 4) ).
Or something along those lines.
Mathematic statement: [log_4(k)]
Code: floor( log(k) / log(4) )
log base 4 of k? Can take the floor if you only care about integer n.
Taking (k)/(4^n) >= 1, multiply both sides by 4^n to get k >= 4^n, and then take the log base 4 (log_4) of both sides to get log_4 k >= n, or n <= log_4 k. (Equivalently, take log of both sides and get log k >= log(4^n), then note log(4^n) = n log(4), and divide to get (log k)/(log 4) >= n). Choose the largest integer n satisfying this inequality, which is floor(log_4 k).

Resources