Talk:Hofstadter Q sequence: Difference between revisions

From Rosetta Code
Content added Content deleted
 
(added recursion limit issue)
Line 1: Line 1:
==Python non-recursive solution==
==Python non-recursive solution==
Thanks Ledrug. I had a brain freeze on removing the recursion and blundered on with the accommodation of the recursion limit solution. --[[User:Paddy3118|Paddy3118]] 18:34, 23 October 2011 (UTC)
Thanks Ledrug. I had a brain freeze on removing the recursion and blundered on with the accommodation of the recursion limit solution. --[[User:Paddy3118|Paddy3118]] 18:34, 23 October 2011 (UTC)
==Recursion limit issue==
As [[User:Ledrug|Ledrug]] pointed out wrt. to my Dart solution with cache, there is a problem when calling the function with a large number first (e.g. q(100000)) since the cache is filled recursively counting from n to 2 if it is empty (happens with the Java solution for example).
This doesn't occur in the calculations necessary to solve the tasks since this way the cache is filled ascending.
Maybe the task description should be changed whether it is required to accommodate this. --[[User:AlexLehm|AlexLehm]] 09:53, 28 October 2011 (UTC)

Revision as of 09:53, 28 October 2011

Python non-recursive solution

Thanks Ledrug. I had a brain freeze on removing the recursion and blundered on with the accommodation of the recursion limit solution. --Paddy3118 18:34, 23 October 2011 (UTC)

Recursion limit issue

As Ledrug pointed out wrt. to my Dart solution with cache, there is a problem when calling the function with a large number first (e.g. q(100000)) since the cache is filled recursively counting from n to 2 if it is empty (happens with the Java solution for example). This doesn't occur in the calculations necessary to solve the tasks since this way the cache is filled ascending. Maybe the task description should be changed whether it is required to accommodate this. --AlexLehm 09:53, 28 October 2011 (UTC)