Questions tagged [recurrence]

A recurrence relation is an equation that recursively defines a sequence, once one or more initial terms are given: each further term of the sequence is defined as a function of the preceding terms.

A recurrence relation is a set of equations that recursively define a sequence, with one or more initial terms given, and each subsequent term defined as a function of the preceding terms.

An example is the Fibonacci sequence, which can be defined as:
F(n) = F(n-1) + F(n-2), with F(0) = 1 and F(1) = 1.

Some simply defined recurrence relations can have very complex (chaotic) behaviours and they are a part of the field of mathematics known as nonlinear analysis.

Solving a recurrence relation means obtaining a closed-form solution: a non-recursive function expressed analytically in terms of a finite number of certain "well-known" functions.

Recurrence relations are of fundamental importance in analysis of algorithms. In computer science, recurrence usually emerges when we analyze the complexity of divide-and-conquer algorithms. If an algorithm is designed so that it will break a problem into smaller subproblems (divide and conquer), its running time is described by a recurrence relation.

For some typical recurrence relations, the asymptotic growth can be analyzed via the Master Theorem.

1040 questions
8
votes
2 answers

How to solve the following recurrence?

I am not familiar with recurrence-solving techniques outside of the master theorem, recursion trees, and the substitution method. I am guessing that solving the following recurrence for a big-O bound does not utilize one of those methods: T(n) =…
8
votes
3 answers

Solving recurrence T(n) = 2T(n/2) + Θ(1) by substitution

So I am pretty sure it is O(n) (but it might not be?), but how do you solve it with substitution? If you assume T(n) <= c * n, what is the induction steps?
evenodd
  • 2,026
  • 4
  • 26
  • 38
8
votes
4 answers

Maximizing difference between numbers in a sequence

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 method, but I can't figure out a simple solution.…
pulagroasa
  • 115
  • 1
  • 7
7
votes
3 answers

Does Python have an iterative recursion generator function for first-order recurrence relations?

Is there a built in function or standard library function roughly equivalent to def recur_until(start, step_fu, stop_predicate=lambda _: False): current = start while not stop_predicate(current): yield current current =…
das-g
  • 9,718
  • 4
  • 38
  • 80
7
votes
3 answers

Recurrence Relation: Solving Big O of T(n-1)

I'm solving some recurrence relation problems for Big O and so far up till this point have only encountered recurrence relations that involved this form: T(n) = a*T(n/b) + f(n) For the above, it's quite easy for me to find the Big O notation. But I…
Parth
  • 235
  • 2
  • 4
  • 7
7
votes
2 answers

time complexity of relation T(n) = T(n-1) + T(n/2) + n

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 O(n ^ 2) or it is wrong?
7
votes
4 answers

T(n)=2T(n−−√)+logn

I am trying to find the time complexity for the recurrence: T(n) = 2T(n1/2) + log n I am pretty close to the solution, however, I have run into a roadblock. I need to solve: n(1/2k) = 1 for k to simplify my substitution pattern. I am not…
Waqas
  • 311
  • 1
  • 3
  • 10
7
votes
1 answer

Counting heads - Dynamic Programming

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 random, where pi is the probability that the ith coin…
Gaurav
  • 1,005
  • 3
  • 14
  • 33
7
votes
2 answers

Recurrence relation: T(n) = T(n/2) + n

Hi there I am trying to solve the following recurrence relation by telescoping but I am stuck on the last step. T(N) = T(N/2) + N T(1)=0 T(N/2) = T(N/4) + N/2 T(N/4) = T(N/8) + N/4 ... T(2) = T(1) + 2 T(N)= T(1) + N + N/2 + N/4 I…
Harry Tiron
  • 287
  • 2
  • 3
  • 9
7
votes
1 answer

Is there a standard for storing and parsing strings for calendar date recurrence?

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 RecurrencePattern - string I wanted to see if there was…
leora
  • 188,729
  • 360
  • 878
  • 1,366
6
votes
1 answer

How to make DifferenceRoot and RecurrenceTable useful for non-numeric difference equations?

In answering a physics forum question this morning, I ran into really bad performance of DifferenceRoot and RecurrenceTable compared to calculating the expressions by naively taking derivatives of an exponential generating functional. A very small…
Simon
  • 14,631
  • 4
  • 41
  • 101
6
votes
3 answers

SQLite statement to query for Recurring Calendar Events

I am designing a Calendar Application, which recurrence None, Daily, Weekly, Monthly & Yearly. One of my requirements is that "No two events should be overlapping" Name of the Table where I store the data Events fields dtstart - Event…
Faheem Kalsekar
  • 1,420
  • 3
  • 25
  • 31
6
votes
1 answer

Big O Question - Algorithmic Analysis III

I have the following question: Solve the recurrence relation simplifying the answer using Big 'O' notation: f(0) = 2 f(n) = 6f(n-1)-5, n>0 I know this is a first order inhomogenous recurrence relation and have had a go at the question but I cannot…
user559142
  • 12,279
  • 49
  • 116
  • 179
6
votes
3 answers

Recurrence rule definition (RFC2445) question

I'm using Google's RFC2445 implementation (http://code.google.com/p/google-rfc-2445/) for recurrence rules. If I define a MONTHLY recurrence starting on the 30th of January, months with less than 30 days (i.e., February) will be totally skipped. So…
Cormac Redmond
  • 231
  • 2
  • 8
6
votes
3 answers

Whats the best java date recurrence pattern calculator

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. We have tried chronos but discovered some cases…
Robin
  • 2,616
  • 22
  • 30
1 2
3
69 70