|
||||||
| C and C++ C and C++ forum for discussing all forms of C except for C#. These languages are powerful low level languages used for creating Operating Systems, Device Drivers, compilers and much more. |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
|
|||
|
You might want to assert(x >= 0) at the start of the function.
This isn't very efficient either but is the direct recursive translation of the function. You can improve that with either a hash table storing known solutions or by switching to an iterative version. The first isn't easy to pull off nicely in C (lack of closures or objects) but the second can be done. |
|
|||||
|
My three solutions
![]() C++ Code:
__________________
CodeCall Blog | CodeCall Wiki | Shareware | Linux Forum | My Blog Chat with other CodeCall members on IRC; connect to irc.codecall.net and join #codecall Last edited by John; 11-19-2007 at 01:05 AM. |
| Sponsored Links |
|
|
|
|||||
|
This article might be a bit of help:
Fibonacci Numbers
__________________
Quote:
|
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| if text1.text = number | ikkeugh | Visual Basic Programming | 2 | 10-21-2007 10:04 AM |
| How to calculate the number of pixels in a polygon | extreme | Java Help | 5 | 04-17-2007 10:34 AM |
| Number Cloning | Ronin | Java Help | 3 | 12-21-2006 07:23 AM |
| I need to generate a random number in PHP | dirkfirst | PHP Forum | 7 | 07-05-2006 09:58 PM |
| Number of files and directories in folder | dirkfirst | PHP Forum | 4 | 05-30-2006 10:06 AM |
Goal: 100,000 Posts
Complete: 67%