recurrence Questions
4
Solved
I have the following worked out:
T(n) = T(n - 1) + n = O(n^2)
Now when I work this out I find that the bound is very loose. Have I done something wrong or is it just that way?
Naominaor asked 2/5, 2010 at 9:23
4
Solved
I'm tried to figure out how to do it for quite of time and its not working as intended; I'm writing a code where there is 1 to k numbers, I need to find all possible combination without repeats. e....
Romish asked 29/10, 2015 at 21:12
3
Solved
I have some problem while trying to calculate time complexity for this code:
function foo (int a):
if a < 1:
return 1
else:
for i = 1 to 4:
foo(a - 3)
for i = 1 to 4:
foo(a / 2)
end fun...
Sweven asked 17/9, 2015 at 16:34
3
Solved
The question comes from Introduction to Algorithms 3rd Edition, P63, Problem 3-6, where it's introduced as Iterated functions. I rewrite it as follows:
int T(int n){
for(int count = 0; n > 2 ...
Redbug asked 14/6, 2015 at 4:50
2
Solved
for the relation
T(n) = T(n-1) + T(n/2) + n
can I first solve the term (T(n-1) + n) which gives O(n^2), then solve the term T(n/2) + O(n^2) ?
according to the master theorem which also gives ...
Webb asked 22/5, 2015 at 17:8
1
Solved
The question is :
UNBALANCED MERGE SORT
is a sorting algorithm, which is a modified version of
the standard MERGE SORT
algorithm. The only difference is that instead of dividing
the input into 2 e...
Squadron asked 2/5, 2015 at 17:39
1
Solved
I am implementing the dynamic programming solution for copying books problem. The idea for the solution is taken from here and here.
Problem statement:
Before the invention of book-printing, it...
Mulberry asked 6/3, 2015 at 8:16
1
Solved
So, on a previous exam, I was asked to solve the following recurrence equation without using the Master Theorem:
T(n)= 9T(n/3) + n^2
Unfortunately, I couldn't figure it out on the exam, so I use...
Monday asked 20/2, 2015 at 21:54
2
Solved
Difference between solving T(n) = 2T(n/2) + n/log n and T(n) = 4T(n/2) + n/log n using Master Method
I recently stumbled upon a resource where the 2T(n/2) + n/log n type of recurrences were declared unsolvable by MM.
I accepted it as a lemma, until today, when another resource proved to be a cont...
Catenane asked 22/1, 2015 at 15:54
6
Solved
T(n) = 2T(n/2) + 0(1)
T(n) = T(sqrt(n)) + 0(1)
In the first one I use substitution method for n, logn, etc; all gave me wrong answers.
Recurrence trees: I don't know if I can apply as the ...
Khalil asked 18/10, 2010 at 3:15
3
Solved
Anyone know of a (reliable) date recurrence calculator, we're trying
to implement something in our app which would allow a schedule to be
created, similar to those for recurring meetings in Outlook...
Ameba asked 29/1, 2009 at 15:28
1
How to find the Big O for the following recursive function using the recursive method:
T(n)=(n-1)T(n-1)+(n-1)T(n-2)
Retinite asked 23/6, 2014 at 9:22
2
Solved
Consider the following recurrence
T(n) = 3T(n/5) + lgn * lgn
What is the value of T(n)?
(A) Theta(n ^ log_5{3})
(B) Theta(n ^ log_3{5})
(c) Theta(n Log n )
(D) Theta( Log n )
Answer is (A)
My ...
Newly asked 12/6, 2014 at 7:2
3
Solved
I want to run this function everyday midnight to check expiry_date_notification. what can I do? I'm new to django and python.
def check_expiry_date(request):
products = Product.objects.all()
for...
Geld asked 9/5, 2014 at 11:52
5
Solved
I have been writing a program for the following recurrence relation:
An = 5An-1 - 2An-2 - An-3 + An-4
The output should be the Answer modulus 10^9 + 7..
I wrote a brute force approach for ...
Barby asked 5/9, 2012 at 7:39
3
Solved
I recently found a contest problem that asks you to compute the minimum number of characters that must be inserted (anywhere) in a string to turn it into a palindrome.
For example, given the strin...
Sardine asked 10/2, 2010 at 13:19
4
I want to find out the time complexity of the program using recurrence equations.
That is ..
int f(int x)
{
if(x<1) return 1;
else return f(x-1)+g(x);
}
int g(int x)
{
if(x<2) return 1;
e...
Carburize asked 24/3, 2013 at 6:35
4
Solved
I need some help in finding the general idea for an algorithm to solve the following problem. The problem has been given to me in an assignment. It looks like it should be solvable through a greedy...
Kriegspiel asked 14/3, 2013 at 20:44
2
Solved
I am trying to solve a recurrence using substitution method. The recurrence relation is:
T(n) = 4T(n/2)+n2
My guess is T(n) is Θ(nlogn) (and i am sure about it because of master theorem)...
Retorsion asked 3/3, 2013 at 12:30
2
Solved
In Cormen's Introduction to Algorithm's book, I'm attempting to work the following problem:
Show that the solution to the recurrence relation T(n) = T(n-1) + n is O(n2 ) using substitution
...
Barrister asked 26/1, 2013 at 2:46
1
First of all sorry for asking such a basic question.
But I am having difficulties understanding substitution method for solving recurrences.I am following Introduction to Algo.s -CLRS. As I am not...
Methaemoglobin asked 9/1, 2013 at 8:0
1
Solved
Problem:
Given integers n and k, along with p1,p2,..., pn; where pi ε [0, 1], you want to determine the probability of obtaining exactly k heads when n biased coins are tossed independently at r...
Megalo asked 27/10, 2012 at 11:29
4
Solved
I'm really trying to wrap my brain around how recursion works and understand recursive algorithms. For example, the code below returns 120 when I enter 5, excuse my ignorance, and I'm just not seei...
Vav asked 27/7, 2012 at 18:43
2
Solved
I'm in a bit of a jam searching for the recurrence formula of this java method
void printInorder(Node<T> v) {
if(v != null) {
printInorder(v.getLeft());
System.out.println(v.getData());
...
Nubbly asked 9/7, 2012 at 1:49
1
Solved
I am trying to store recurrence event information into a database. I want to store recorder into a a Database table with the following fields.
Start Date - Datetime
End Date - DateTime
Recurrence...
Coccidiosis asked 8/4, 2012 at 17:48
© 2022 - 2024 — McMap. All rights reserved.