Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   C Programming (http://www.velocityreviews.com/forums/f42-c-programming.html)
-   -   How to calculate Fibonacci with template? (http://www.velocityreviews.com/forums/t956746-how-to-calculate-fibonacci-with-template.html)

 Helong Feng 01-21-2013 10:11 AM

How to calculate Fibonacci with template?

to ensure the complexity is O(1).THX~

 bert 01-21-2013 10:25 AM

Re: How to calculate Fibonacci with template?

On Monday, 21 January 2013 10:11:58 UTC, Helong Feng wrote:
> to ensure the complexity is O(1).THX~

Work out your own recurrence relation which
approximately doubles the index at each step.
{F} = ... 3, 5, 8, ... 55, 89, ...
and: 55 = 8^2 - 3^2, 89 = 8^2 + 5^2.
--

 Noob 01-21-2013 12:22 PM

Re: How to calculate Fibonacci with template?

Helong Feng wrote:

> How to calculate Fibonacci with template to ensure
> the complexity is O(1)

There are no templates in C.

 Kenny McCormack 01-21-2013 01:19 PM

Re: How to calculate Fibonacci with template?

In article <kdjbrb\$30k\$1@dont-email.me>, Noob <root@127.0.0.1> wrote:
>Helong Feng wrote:
>
>> How to calculate Fibonacci with template to ensure
>> the complexity is O(1)

>
>There are no templates in C.
>

But there is in C/C++/C# - which is what most people really mean nowadays
when they refer to "C".

--
Nov 4, 2008 - the day when everything went
from being Clinton's fault to being Obama's fault.

 Les Cargill 01-21-2013 01:29 PM

Re: How to calculate Fibonacci with template?

Kenny McCormack wrote:
> In article <kdjbrb\$30k\$1@dont-email.me>, Noob <root@127.0.0.1> wrote:
>> Helong Feng wrote:
>>
>>> How to calculate Fibonacci with template to ensure
>>> the complexity is O(1)

>>
>> There are no templates in C.
>>

>
> But there is in C/C++/C# - which is what most people really mean nowadays
> when they refer to "C".
>

I don't think anybody confuses C# with the other two. C# was
specifically designed as a heresy on C++ - for "the language

--
Les Cargill

 Kenny McCormack 01-21-2013 02:41 PM

Re: How to calculate Fibonacci with template?

In article <kdjfmu\$q03\$1@dont-email.me>,
Les Cargill <lcargill99@comcast.com> wrote:
>Kenny McCormack wrote:
>> In article <kdjbrb\$30k\$1@dont-email.me>, Noob <root@127.0.0.1> wrote:
>>> Helong Feng wrote:
>>>
>>>> How to calculate Fibonacci with template to ensure
>>>> the complexity is O(1)
>>>
>>> There are no templates in C.
>>>

>>
>> But there is in C/C++/C# - which is what most people really mean nowadays
>> when they refer to "C".
>>

>
>
>I don't think anybody confuses C# with the other two. C# was
>specifically designed as a heresy on C++ - for "the language

Heh heh. I hear ya. And I did just throw in the C# reference to further
annoy the regs here - as if the sight of those 2 plus signs following the
name of their beloved language wasn't enough.

But, seriously folks, from what I hear, in the "business" world these days,
C# *is* pretty much considered to be the current incarnation of C. Even C++
is considered to be a "legacy language".

--
People who say they'll vote for someone else because Obama couldn't solve
all of Bush's messes are like people complaining that he couldn't cure cancer,
so they'll go and vote for cancer.

 Shao Miller 01-21-2013 04:20 PM

Re: How to calculate Fibonacci with template?

On 1/21/2013 09:41, Kenny McCormack wrote:
> In article <kdjfmu\$q03\$1@dont-email.me>,
> Les Cargill <lcargill99@comcast.com> wrote:
>> Kenny McCormack wrote:
>>> In article <kdjbrb\$30k\$1@dont-email.me>, Noob <root@127.0.0.1> wrote:
>>>> Helong Feng wrote:
>>>>
>>>>> How to calculate Fibonacci with template to ensure
>>>>> the complexity is O(1)
>>>>
>>>> There are no templates in C.
>>>>
>>>
>>> But there is in C/C++/C# - which is what most people really mean nowadays
>>> when they refer to "C".
>>>

>>
>>
>> I don't think anybody confuses C# with the other two. C# was
>> specifically designed as a heresy on C++ - for "the language

>
> Heh heh. I hear ya. And I did just throw in the C# reference to further
> annoy the regs here - as if the sight of those 2 plus signs following the
> name of their beloved language wasn't enough.
>

I don't understand why you'd want to do that.

> But, seriously folks, from what I hear, in the "business" world these days,
> C# *is* pretty much considered to be the current incarnation of C. Even C++
> is considered to be a "legacy language".
>

It's fun that the '#' can be decomposed into 4 tiny '+' signs, perhaps
resulting an operation like: (c++)++ Unfortunately, that operation
doesn't work, in C.

--
- Shao Miller
--
"Thank you for the kind words; those are the kind of words I like to hear.

Cheerily," -- Richard Harter

 Noob 01-21-2013 07:43 PM

Re: How to calculate Fibonacci with template?

Shao Miller wrote:

> I don't understand why you'd want to do that.

I don't understand what you don't understand.

Trolls will be trolls.

 All times are GMT. The time now is 03:26 AM.