16,004,574 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View .NET questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by Avi Farah (Top 3 by date)
Avi Farah
11-Sep-17 17:06pm
View
Again, your question is way too vague for me to comment on specifics. Are we still dealing with the same algorithm? How do the letters A, B, C, D apply to the algorithm.
My feeling is that you need to go after your logic, that you did not publish.
What comes to mind about your double recursive call is fibonacci series:
fibonacci[0] = f0 (a constant say 0)
fibonacci[1] = f1 (another constant say 1)
fibonacci[n] = fibonacci[n-2] + fibonacci[n-1]
This is a double recursive call (btw very computing time expensive)
However we can simplify/cheapen it: consider a 2 number tuple denoted by (x, y) then:
fib[0] = (f0, f1)
fib[n] = next(fib[n-1])
where next( (x,y) ) = (y, x + y)
and fibonacci[n] = fib[n].First
Now we succeeded to reduce a 2 recursive call to 1.
Hope this helps.
Avi
Avi Farah
6-Sep-17 16:51pm
View
Your question is too vague.
In general to write a recursive program you need:
1. A recursive definition and
2. A terminating condition.
Your terminating condition is checked before your recursive-call and the recursive-call needs to get you closer to the terminating condition evaluating true, otherwise you will end up in an infinite recursion.
Hope this helps,
Avi
Avi Farah
11-Jan-17 21:39pm
View
Nathan, thank you! I'm hoping to be able use an existing functionality as opposed to building the logic that is in the compiler. When I figure it out I'll post it.