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 months ago.
Improve this question
I've been trying to solve this problem but I am stuck at the last bit and my University lecturer doesn't really want to help me :)
T(1) = 1
T(n) = n*T(n/2)
T(n/2) = n/2 * T(n/4);
T(n/4) = n/4 * T(n/8);
T(n/8) = n/8 * T(n/16);
The four forms:
1) T(n) = n * T(n/2); k = 1
2) T(n) = (n^2)/2 * T(n/4); k = 2
3) T(n) = (n^3)/8 * T(n/8); k = 3
4) T(n) = (n^3)/64 * T(n/16); k = 4
T(n) = (n^k)/??? * T(n/k^2)
I can see the relationship, but I don't quite know what the ??? equals, nor how to continue. Honestly, any help would be greatly appreciated. Thank you!
Well my first guess would be that the "???" equals
2^(k-1),
because then the sequence would be like, 2^1-1=1, 2^2-1=2 and so on...
Then you would have the recurrence relation as follows:
T(n)=(n^k)/(2^(k-1)) * T(n/k^2)
Then you can prove by induction that this holds for any n. And I assume that since this an algorithm-related question, this would give you a bound for the running time.
Related
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 3 years ago.
Improve this question
Given the equation (depth = log(c * p + 1) / log(c * 1000 + 1) * p)
How can I find p?
I wanted to get an equation with p = sqrt(exp(... or something like this
The isn't an analytical solution to problems like this because they contain the variable both inside and outside a transcendental function like log().
With some quick algebra, you can simplify the expression to
p*log(1 + c*p) = b
where b=depth*log(1+1000*c) is a constant.
I propose using a single point iteration, to get a numeric result.
Start with some guess of p=1 or something and then do a loop until you converge to a value of (c# shown below).
b = depth*log(1+1000*c);
p = 1;
do
{
p_old = p;
p = b/log(1+c*p);
}
while( abs(p-p_old)> 1e-6);
and hope it converges soon.
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
I want to know how to solve a recurrence relation in 2 variables. I want to solve below relation:
F(n,m) = F(n-1,m) + F(n,m-1) + 1
Initial conditions:
F(m,0) = m
F(0,n) = n
F(0,0) = 0
F(n,m)
{
if (n==0)&&(m==0)
return 0
else if (n==0)
return m
else if (m==0)
return n
else
return F(n-1,m) + F(n,m-1) + 1
}
Only parameters (≦ n, ≦ m) occur, one may exclude n or m being 0, so if you could hold a table of n×m that would be the optimal complexity: O(n . m).
One sees, that F(n - 1, m - 1) are both called, from F(n - 1, m) and F(n, m - 1), so a naive solution has a higher complexity.
Not wanting to spoil the joy of finding an algorithm, only some hints:
F(n, m) = F(m, n) so you may use n ≦ m.
(table, result) = F'(table, n, m) caching of results in recursive function
I personally sometimes like to start with an iterative non-functional procedure to fill a table, starting from 0 upwards. And then turn that into functional notation. For complexity an iterative procedure would already suffice.
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
How to demonstrate that all multiplicative orders divide the order (size) of the multiplicative group F of F13.
.
You show that the cyclic group <x> generated by an element x is a subgroup of IF* and that "u~v iff u^(-1)*v in <x>" is an equivalence relation that divides the multiplicative group into equivalence classes of equal size.
So that you get
[size of IF*]
= [size of <x>] * [number of equivalence classes]
which means that the order of x = [size of <x>] is a divisor of the number of invertible elements, i.e., the size of the multiplicative group of IF
See also the little theorem of Fermat.
Since the group is abelian, the simplest thing is to use that multiplication by any element is a bijection. Let F = {g1, g2, g3, ..., gn} and let h be an arbitrary element. Then also F = {h*g1, h*g2, ..., h*gn}. Hence multiplying all elements together we get g1 * g2 * g3 * ... * gn = h*g1 * h*g2 * ... * h*gn. But the latter equals h^n * g1 * g2 * ... * gn. Now use the cancellation law to conclude that h^n = 1 from which the result follows.
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 10 years ago.
Improve this question
Is there a way to solve a general recurrence relation of the form
a(n)=a(n-1) * a(n-2)....
I mean I can use the matrix method to solve a relation of the form
F(n)=a1*F(n-1) + a2*F(n-2).......+ ak*F(n-k)
but what to do when there is a '*' sign instead of '+'
Use logarithms:
a(n) = a(n-1) * a(n-2) * a(n-3) * ....
Take log of both sides:
log(a(n)) = log(a(n-1) * a(n-2) * a(n-3) * ...)
Use the fact that log(a * b) = log(a) + log(b) to split up the factors:
log(a(n)) = log(a(n-1)) + log(a(n-2)) + log(a(n-3)) + ...
Now, if you just say that F(n) = log(a(n)) then this equation looks just like your second equation. Use the matrix method to solve for log(a(n)):
log(a(n)) = X
Which leaves:
a(n) = e ^ X
(Assuming you take natural logarithms)
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 11 years ago.
Improve this question
I am trying to solve a Mathematical equation in one of my geometric modelling problem.
Let's say if I have 2 vectors, A and B, and I have the following equation:
A x B = c (c is a scalar value).
If I know the coordinate of my vector B (7/2, 15/2); and I know the value of c, which is -4.
How can I calculate my vector A, to satisfy that equation (A X B = c) ?
The problem is underdetermined; there isn't a unique such A. I assume that by "multiplication" you mean the cross product.
A = (x,y)
B = (7/2, 15/2)
A×B = x(15/2) - y(7/2)
-4 = (15x-7y)/2
15x - 7y = -8
This gives a line along which points A=(x,y) can lie. Specifically, for any real number t,
x = -1 + 7t
y = -1 + 15t
gives a solution.