473,498 Members | 703 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Weekend thought provoker - nonclean overlapping recursion

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

Apr 14 '06 #1
4 1451
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
Apr 14 '06 #2
"Csaba Gabor" <da*****@gmail.com> writes:
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.


No problems spring to mind, that you haven't already mentioned.
My first guess was to check Wikipedia, but you're way ahead of them,
so you might consider updating their entry with your examples:
<URL:http://en.wikipedia.org/wiki/Overlapping_subproblem>

Hmm, on the other hand, there are lots of examples of algorithms
using dynamic programming. Those should be overlapping problems:
<URL:http://en.wikipedia.org/wiki/Dynamic_programming>

Good luck. Crosspost and Followup-To: sci.math, which I think is
more appropriate.
/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'
Apr 14 '06 #3
JRS: In article <8x**********@hotpop.com>, dated Fri, 14 Apr 2006
12:43:27 remote, seen in news:comp.lang.javascript, Lasse Reichstein
Nielsen <lr*@hotpop.com> posted :
"Csaba Gabor" <da*****@gmail.com> writes:
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.


No problems spring to mind, that you haven't already mentioned.


The OP posted to too many newsgroups for me to see the article.

JAD9514.PAS, via sig line 3, may provide an example for those who can
read a 58-line Pascal program :-

{ Determine the number of ways of giving change for PTot pence,
using the coins in Pence. }

{$DEFINE CACHE}

....

Note : Without CACHE, time for Total=500 is intolerable ;
With CACHE, imperceptible ;


Whenever the number of possible sub-problems permits, sub-problem
results should be cached in a suitable structure. For numeric problems,
the elements of the initial structure can be non-existent, undefined, or
NaN.

Ackermann's Function is another example.

--
© John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 MIME. ©
Web <URL:http://www.merlyn.demon.co.uk/> - FAQqish topics, acronyms & links.
PAS EXE TXT ZIP via <URL:http://www.merlyn.demon.co.uk/programs/00index.htm>.
Do not Mail News to me. Before a reply, quote with ">" or "> " (SoRFC1036)
Apr 14 '06 #4
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
Apr 15 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
3395
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....
1
3239
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) .......
11
4646
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...
3
12782
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...
43
4115
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;
2
1552
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...
4
4847
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...
7
3209
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...
35
4682
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 ??
0
7124
marktang
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,...
0
7163
Oralloy
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,...
0
7200
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7375
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5460
agi2029
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,...
1
4904
isladogs
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...
0
3078
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1416
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 ...
0
287
bsmnconsultancy
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.