I suppose spring fever has hit at alt.math.undergrad since I didn't get
any rise from
them when I posted this a week ago, so I am reposting this to some of
my favorite
programming groups:
I'm looking for problems that have double (or more) recursion, where
the split is not
clean (ie. where there may be overlap). Let's call this overlapped
recursion, where the
same subproblem may have to be solved multiple times.
By way of illustration.
Single recursion:
factorial
Clean double recursion:
merge sort
depth first searches (DFS), and other binary tree
Overlapped recursion (what I'd like more examples of):
1. Ackermann's function and relatives
2. Tower of Hanoi
3. Determining the nth number in the Fibonacci or Lucas series
4. Counting the number of ways to change 1 dollar (ie. number of
distinct ways to sum
numbers (repetitions allowed) from a list L to arrive at N. In the
example N=100 and L=[1,
5, 10, 25, 50])
I'm especially happy for those problems that have a physical analogue.
Thanks,
Csaba Gabor from Vienna 2 1550
Csaba Gabor wrote: I'm looking for problems that have double (or more) recursion
Are you looking for problems to solve?
Here's an interesting one that I have been playing around with recently (not
sure if this is what you wanted or not):
x_n = k + y_n-1 + abs(x_n-1), x_0 = 1
y_n = x_n-1, y_0 = 2
If you play with your seeds and k, you get some interesting stuff.
Carl
--
Carl Vondrick
Web-Engineer www.carlsoft.net
On 2006-04-14, Csaba Gabor <da*****@gmail.com> wrote: I suppose spring fever has hit at alt.math.undergrad since I didn't get any rise from them when I posted this a week ago, so I am reposting this to some of my favorite programming groups:
I'm looking for problems that have double (or more) recursion, where the split is not clean (ie. where there may be overlap). Let's call this overlapped recursion, where the same subproblem may have to be solved multiple times.
By way of illustration. Single recursion: factorial
Clean double recursion: merge sort depth first searches (DFS), and other binary tree
Overlapped recursion (what I'd like more examples of): 1. Ackermann's function and relatives
Ackerman overlaps? it seemed to me more like it blows out.
2. Tower of Hanoi
I'm sure I've seen a heuristic solution to that one.
3. Determining the nth number in the Fibonacci or Lucas series
Possible with single recursion:
F(n)= g(0,1,n)
g(a,b,n)= a where n=0
g( b, a+b , n-1 ) otherwise
And that's end-recursion which is just iteration in drag.
4. Counting the number of ways to change 1 dollar (ie. number of distinct ways to sum numbers (repetitions allowed) from a list L to arrive at N. In the example N=100 and L=[1, 5, 10, 25, 50])
there are non-recurssive solutions for this one too...
I'm especially happy for those problems that have a physical analogue.
the class of problems solvable using overlapped recursion far exceeds the
class that must be solved in that way.
you may want to look in comp.lang.ml
Standard ML handles overlapped recursion in a sensible way and so
algorithms with the form you're looking for should be popular there.
Bye.
Jasen This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Peri |
last post by:
I'm trying to create Python parser/interpreter using ANTLR.
Reading grammar from language refference I found:
or_expr::= xor_expr | or_expr "|" xor_expr
For me it looks like infinite recursion....
|
by: André Søreng |
last post by:
With the re/sre module included with Python 2.4:
pattern = "(?P<id1>avi)|(?P<id2>avi|mp3)"
string2match = "some string with avi in it"
matches = re.finditer(pattern, string2match)
.......
|
by: Max M |
last post by:
I am writing a "find-free-time" function for a calendar. There are a lot
of time spans with start end times, some overlapping, some not.
To find the free time spans, I first need to convert the...
|
by: Phil Sandler |
last post by:
All,
I have a table with start and end dates/times in it, and would like to
be able to calculate the number of hours represented, accounting for
overlapping records.
Note that I am looking...
|
by: Lorenzo Villari |
last post by:
I've tried to transform this into a not recursive version but without
luck...
#include <stdio.h>
void countdown(int p)
{
int x;
| |
by: Csaba Gabor |
last post by:
I suppose spring fever has hit at alt.math.undergrad since I didn't get
any rise from
them when I posted this a week ago, so I am reposting this to some of
my favorite
programming groups:
I'm...
|
by: =?ISO-8859-15?Q?Jean=2DFran=E7ois?= Lemaire |
last post by:
Hello all,
I'm learning C and I still am struggling to understand some basic
concepts. For example, I read in the standard that with functions such
as strcpy, 'If copying takes place between...
|
by: athar.mirchi |
last post by:
..plz define it.
|
by: Mike |
last post by:
I have a routine that's calculating business days but its not counting the
weekend days that are between the start date and end date. If my start date
is 9/26/08 and my end date is 10/01/08, I...
|
by: Muzammil |
last post by:
int harmonic(int n) {
if (n=1) {
return 1;
}
else {
return harmonic(n-1)+1/n;
}
}
can any help me ??
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
| |
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...
| |