Questions dealing with recursive algorithms. Their analysis often involves recurrence relations, which have their own tag.

learn more… | top users | synonyms

0
votes
0answers
18 views

Help finalizing a recurrence relation

(Yes this is homework) Given recurrence $$T(n) = 3T(n/2) + O(n)$$ $$let\:cn >= O(n)$$ for some constant c I can bound $$T(n)$$ in terms of $$T(n/2)$$ so I have $$T(n) <= 3T(n/2)+cn, \ \ \ \ \ ...
0
votes
1answer
17 views

Need to understand the end of Karatsuba algorithm running time proof

I cannot understand the end of Karatsuba algorithms running time proof. Initially we have formula $$T(n) = 3T(\frac{n}{2}) + rn$$ if n > 1 $$T(n) = r $$ if n = 1 , where r is a constant. We assumed ...
0
votes
0answers
15 views

Solving recurrence relations using master's theorem

Can we solve following recurrence relation using master's theorem- T(n)=T(n/2)+log n The thing to notice here is that, do n (n^logb a) and log n (f(n)) have an exponential difference?
3
votes
1answer
41 views

How to prove that calculating Ackermman function stops?

Let $$\begin{eqnarray*} A(0,y) &=& y+1 \\ A(x+1,0) &=& A(x,1) \\ A(x+1,y+1) &=& A(x,A(x+1,y)) \end{eqnarray*}$$ be Ackermann function. How to prove by structural induction ...
0
votes
0answers
31 views

$T(n) = T(n/3) + T(2n/3) + cn$ - recursion tree with constance $c$

I have a task: Explain that by using recursion tree that solution for: $T(n)=T(\frac n3)+T(\frac 2n3)+cn$ Where c is constance, is $\Omega(n\lg n)$ My solution: 1. Recursion tree for $T(n)=T(\frac ...
0
votes
1answer
60 views

Find a recursive equation for wn and provide enough initial conditions so that the values of the wn will be determined by the recursion. [closed]

I want to pave a 2×n rectangle with 1×2 blocks which come in two colours, white and grey. Let wn be the number of different ways this can be done. For example, it can be shown that w8 = 8704 and the ...
1
vote
0answers
27 views

Recursion tree T(n) = T(n/3) + T(2n/3) + cn

I have a task: Explain that by using recursion tree that solution for: $T(n)=T(\frac n3)+T(\frac 2n3)+cn$ Where c is constance, is $\Omega(n\lg n)$ My solution: 1. Recursion tree for $T(n)=T(\frac ...
1
vote
0answers
5 views

algorithm related to dyadic decomposition

Starting from an integer $n >0$, iterate the two operations of substracting one and dividing by $2$ (when the number is even) until $1$ is reached. Thus when the number is odd we can only substract ...
1
vote
0answers
11 views

Using FFT to compute DFT of a polynomial

i currently studying about FFT and DFT and we were given simple question: Use the recursive FFT to compute the DFT of this polynomial of '3' degree: $$-1\:+\:4x\:+\:3x^2$$. So, i go to this ...
0
votes
1answer
31 views

Can someone check my answers to this problem?

This is from Discrete Mathematics and its Applications Definition of recurrence relation from book From my understanding, compounded annually means that every year(annually) the account will ...
0
votes
0answers
14 views

Blum Micali Algorithm Security By Seed Size

I'm coming from a computer science background, so I'm having some difficulty with these high level mathematics. With reference to the Blum Micali algorithm: (underscore represent subscript) ...
0
votes
1answer
20 views

Feasible method of grouping relations

This might be a bad question, I hope not so bad. Problem is I have a set of relations(millions), presumably two arrays hold two nodes(starting, and ending), which together forms a relation(edge). I ...
3
votes
0answers
41 views

Algorithm for Converting Rational Into Surreal Number

I'm writing a library in Haskell that represents the class of surreal numbers, which like many things can be read about here. I've run into a problem in converting between other classes of numbers ...
3
votes
0answers
101 views

How can I convert a recursive equation to a non-recursion one? [duplicate]

While I am aware of several other similar question which have been asked in the past, my mathematical education only extends through calculus, making them beyond my comprehension, and I believe this ...
5
votes
2answers
305 views

Characteristic equation. What is it?

Consider a recursive equation: $$ a_n = A a_ {n-1} + Ba_ {n-2} $$ And for this type of equation, there is characteristic equation: $ x ^ 2 = Ax + B $. What does exactly means that this equation is ...
1
vote
0answers
19 views

Closest pair algorithm in high dimension?

2D case is clear. But with dimensions higher than 2 I should choose a special partitioning hyperplane for the divide and conquer algorithm to get O(n log n). I am confused because to choose this ...
1
vote
1answer
36 views

Give tight asymptotic bounds for the following recurrence. T(n) = 3T(n/3)+log n

Give tight asymptotic bounds for the following recurrence. Justify your answers by working out the details or by appealing to a case of the master theorem $$T(n) = 3T\left(\frac n3\right)+\log(n)$$ ...
3
votes
1answer
31 views

Finding all local $k$-maximums in sequence $a_1, a_2, \ldots a_n$.

For given sequence of numbers $a_1, a_2, \ldots, a_n$ we say that $a_i$ is $k$-local maximum, if $i > k$ and $a_i$ is largest of numbers $a_{i - k}, a_{i-k+1}, \ldots, a_i$. How can we find all ...
3
votes
1answer
42 views

Finding $m$ largest numbers from union of $k$ sorted lists $A_1, A_2, \ldots, A_k$

We are given $k$ sorted lists $A_1, A_2, \ldots A_k$ with corresponding sizes $n_1, n_2, \ldots n_k$. How can one find $m$ largest elements (numbers) from union of lists $A_1, A_2, \ldots, A_k$? We ...
2
votes
0answers
92 views

How can we find the elements?

I want to describe an algorithm with time complexity $O(m)$ that, given a set $M$ with $m$ numbers and a positive integer $p \leq m$, returns the $p$ closest numbers to the median element of the set ...
3
votes
1answer
36 views

Question about recursive algorithm

I have following problem: $$f(n)=\frac{1}{1^2+1}+\frac{2}{2^2+1}+\frac{3}{3^2+1}+\cdots+\frac{n}{n^2+1}$$ Write recursive algorithm for $f(n)$ Prove that recursive algorithm is correct ...
3
votes
1answer
74 views

How can I recursively approximate a moving average and standard deviation?

Consider a sequence of measurements $(x_1, x_2, ...)$. Let $\mu_n$ be the $p$-period moving average defined by $$\mu_n = \frac{1}{p}\sum_{i=n-p+1}^nx_i$$ and $\sigma_n$ be the $p$-period moving ...
0
votes
2answers
52 views

Dynamic programming:Making a Change

I'm practicing problems on dynamic programming.The problem is as follows: You are given n types of coin denominations of values v(1) < v(2) < ... < v(n) (all integers). Assume v(1) = 1, so ...
1
vote
1answer
21 views

Proof by induction for a recursive function f

Consider the function $\operatorname{f}: \Bbb N \to \Bbb N$ defined recursively as follows: 1) Base case: $\operatorname{f}(0) = 0$ 2) Recursive case: $\operatorname{f}(x) = ...
0
votes
1answer
29 views

Proof by induction for a recursive function

Really having a tough time doing this question: Consider the function $\operatorname{f}: \Bbb N \to \Bbb N$ defined recursively as follows: 1) Base case: $\operatorname{f}(0) = 0$ 2) Recursive ...
0
votes
3answers
478 views

Counting arrays with gcd 1

I want to calculate the number of arrays of size $N$, such that for each of it's element $A_i, 1 \leq A_i \leq M$ holds, and gcd of elements of array is 1. Constraints: $1 \leq A_i \leq M$ and $A_i$ ...
1
vote
4answers
127 views

Prove that the Fibonacci recursion diverges

I have this sequence with $ n \in \mathbb{N} $ $ f(1) = f(2) = 1 $ and $ f(n) = f(n-1) + f(n-2) $ for $n \ge 3$ I think this sequence is bounded below and unbounded above. So it's clear that this ...
0
votes
3answers
60 views

Constructing a recursive sequence that converges to sqrt 17

One of the problems that we have for abstract math is the following: Using the recursive sequence definition, construct a sequence that converges to $\sqrt{17}$. It is my understanding that the ...
2
votes
1answer
118 views

All solutions of the recurrence relation

Find all solutions of the recurrence relation $$ a_n = 2a_{n-1}+15a_{n-219}-64a_{n-3}+k $$
0
votes
1answer
27 views

Explicit (General) formula for recursive definition.

I am given $a_n=3a_{n-1}+4^n$, $n=1,2,3,....$ and $a_0=1$. First four terms: $$ \begin{align} a_1&=3.1+4^1=3+4=7\\ a_2&=3.7 + 4^2 = 21 + 16 = 37 \\ a_3&=3.37 + 4^3 = 111 + 64 = 175\\ ...
0
votes
1answer
21 views

Solving time complexity of merge sort

I was asked to prove that the time complexity of merge sort is $ O(log_2n)$ but I cannot find a way to continue my method. Any help? $T(n)=2T(\frac{n}{2} )+n$ $T(n)= 2[2T(\frac{n}{4})+n] +n = ...
0
votes
1answer
16 views

Log property in proof of Master theorem

The family of recurrence considered is of the form $$ T(n) = aT(n/b) + n^c $$ $a,b,c$ are integers. One case of master theorem states: if $c< log_b a$, then $T(n) = \Theta(n^{log_b a}) $. I have ...
3
votes
2answers
96 views

Finding the convergent value of a recursion similar to Arithmetic-Geometric Mean recursion

The sequence is defined as follows : Start : $(x_0,y_0)$ with $ 0 < x_0 < y_0 $ Step : $x_{n+1} = \frac {x_n+y_n} {2}$ , $y_{n+1}= \sqrt{x_{n+1}y_n} $ Find $\lim_{n\to \infty}(x_n,y_n)$ . ...
2
votes
4answers
41 views

Find exact closed form of recurrence $g(0) = 0, g(1) = 3, g(n) = g(n − 1) + 2g(n − 2)$ for $ n \geq 2$

$g(0) = 0, g(1) = 3, g(n) = g(n − 1) + 2g(n − 2)$ for $n \geq 2$ Our lecture notes suggest us to work backwards until you get the first term, i.e. $g(1)$ I am not quite sure how that works as the ...
1
vote
0answers
57 views

Help me generalize what this divisor transform does.

I have an algorithm which takes as input the series expansion of: $$\frac{-(1 + ax(-2 + x + ax))}{-1 + ax} \tag 1$$ or expressed differently: ...
0
votes
0answers
15 views

Find $R[r] \mod M $ where R is a recurrence relation and M can be any integer?

Let N,M are two constant integers and they may or not be prime . A recurrence relation R is defined as using N $R[1]=1$ , $R[r]=\frac{R[r-1]\space * \space p}{r^r}$ , where $p = {(N-r+1)}^{(N-r+1)}$ ...
0
votes
0answers
13 views

Breadth First Search - Building All Possible Trees of a Set

Suppose there is a set of values arranged in a binary search tree (BST). I'm trying to write an algorithm that takes in a sequence, and prints all permutations (BSTs) that have that sequence as their ...
1
vote
0answers
52 views

Trace and transpose of a Matrix

I have a recurrence relation as follows $ \left\{ \begin{array}{ll} R_0=H & \mbox{if } n = 0 \\ R_1 =sR_0 \hspace{.1cm} A & \mbox{if }n=1\\ R_{n+2} =\frac{s}{n+2}\{ R_{n+1} ...
0
votes
1answer
48 views

A Difficult Recursive Equation

I've got a recursive equation of the form $$ x_{n+1} - x_{n} = \frac{(-1)^n}{2 \cdot 4 \cdot 6 \cdot ... \cdot 2n}(x_0-x_1)$$ for $n \geq 2$. We can assume $x_0$ and $x_1$ are just real numbers/ I ...
1
vote
3answers
17 views

running time of an algorithm

I am trying to prove an algorithm with input size $n$ satisties the recurence relation (for $n>=1$) $T(n) = T(n-1)+n$ and an initial condition of $T(1)=1$ has running time in $Θ(n^2$). By using ...
1
vote
0answers
25 views

Solution of ODE with initial values

Given data in the problem ${\psi'(t)}_{3 \times 3}=A_{3 \times 3}\psi(t)_{3 \times 3}, \psi(0)_{3 \times 3}=R^{cl}_{3 \times 3} \\ \phi'(t)_{3 \times 3}=t\hspace{.1cm}B_{3 \times 3} \phi(t)_{3 ...
0
votes
0answers
21 views

Direct Graphs: Prove that for every rooted tree $G=(V,E)$ the algorithm computes a topological sorting of $G$. [duplicate]

Consider the following recursive algorithm for topological sorting of a rooted tree $G=(V,E)$: Apply topological sorting to the vertices in each subtree hanging from the root, and then order the root ...
0
votes
1answer
26 views

$T(n)=T(n-1)+O(\log n)$ is $T(n)=O(n^2)$ or $T(n)=O(n \log n)$

I have this Recurrence relation: $T(n)=T(n-1)+O(\log n)$ What is the solution? $T(n)=O(n^2)$ or $T(n)=O(n \log n)$ What I did is: I assume that $T(n)\le O(n^2)$ And that's bring me to $O(n^2)$, ...
2
votes
2answers
59 views

Towers of Hanoi Starting From Initial (Legal) Configuration?

I was recently asked in an interview how an algorithm for solving the classic Towers of Hanoi problem would differ if you were given an initial (legal) configuration of the towers, and had to start ...
0
votes
0answers
16 views

Recurrence Relation (sequence)

I'm trying to find the relation of {-1,0,1,3,13} i've came close thinking it was (an-1)^2+(an-2)+an-1 but i cant seem to get all 5 of my elements to match up. Any ideas on a solution would be ...
1
vote
3answers
36 views

recursive to explicit sequence

I am trying to find the explicit formula for the following recursion: $$a_{1}=3,\quad a_{n}=3- \frac{1}{a_{n-1}},\quad n \in \mathbb N,n>1$$ I tried in many ways but I cannot find any ...
1
vote
1answer
19 views

Algorithm Running Time

Given an algorithm with a running time $$T(n)=5T(n/2)+n^2$$ So the number of nodes at a depth $i$ would be: $5^i$ The input size for each node at $i$ would be: $n/2^i$ Agreed. Then it states that ...
4
votes
1answer
80 views

How many distinct ways to climb stairs in 1 or 2 steps at a time? (Fibonacci puzzle)

There is a very interesting puzzle for fibonacci sequence ...
0
votes
1answer
32 views

How to find if an array has at least 10 unique integers in $O(\log n)$?

I am given a sorted array of integers. I want to find out if the array has at least 10 unique integers. I know this can easily be done with an algorithm that runs in $O(n)$ simply by going through ...
1
vote
0answers
33 views

Finding the explicit form of the recursive function $P_{1(n)}=\left\lceil\frac12P_{1(n-1)}\right\rceil+\left\lfloor\frac12P_{2(n-1)}\right\rfloor$

I'm trying to find the explicit form of the recursive function $$P_{1(n)}=\left\lceil\frac12P_{1(n-1)}\right\rceil+\left\lfloor\frac12P_{2(n-1)}\right\rfloor\;.$$ First, let me explain what this ...