[#3109] Is divmod dangerous? — Dave Thomas <Dave@...>

14 messages 2000/06/06

[#3149] Retrieving the hostname and port in net/http — Roland Jesse <jesse@...>

Hi,

12 messages 2000/06/07

[#3222] Ruby coding standard? — Robert Feldt <feldt@...>

16 messages 2000/06/09

[#3277] Re: BUG or something? — Aleksi Niemel<aleksi.niemela@...>

> |I am new to Ruby and this brings up a question I have had

17 messages 2000/06/12
[#3281] Re: BUG or something? — Dave Thomas <Dave@...> 2000/06/12

Aleksi Niemel<aleksi.niemela@cinnober.com> writes:

[#3296] RE: about documentation — Aleksi Niemel<aleksi.niemela@...>

> I want to contribute to the ruby project in my spare time.

15 messages 2000/06/12

[#3407] Waffling between Python and Ruby — "Warren Postma" <embed@...>

I was looking at the Ruby editor/IDE for windows and was disappointed with

19 messages 2000/06/14

[#3410] Exercice: Translate into Ruby :-) — Jilani Khaldi <jilanik@...>

Hi All,

17 messages 2000/06/14

[#3415] Re: Waffling between Python and Ruby — Andrew Hunt <andy@...>

>Static typing..., hmm,...

11 messages 2000/06/14

[#3453] Re: Static Typing( Was: Waffling between Python and Ruby) — Andrew Hunt <andy@...>

32 messages 2000/06/16

[#3516] Deep copy? — Hugh Sasse Staff Elec Eng <hgs@...>

Given that I cannot overload =, how should I go about ensuring a deep

20 messages 2000/06/19

[#3694] Why it's quiet — hal9000@...

We are all busy learning the new language

26 messages 2000/06/29
[#3703] Re: Why it's quiet — "NAKAMURA, Hiroshi" <nahi@...> 2000/06/30

Hi,

[#3705] Re: Why it's quiet — matz@... (Yukihiro Matsumoto) 2000/06/30

Hi,

[ruby-talk:03666] Re: Another small quiz

From: Mathieu Bouchard <matju@...>
Date: 2000-06-27 01:43:51 UTC
List: ruby-talk #3666
> When I watched fact with bigger arguments, the recursion gets slower and 
> slower, so I wonder if recursion is fine in interpretative environment.

It is usually assumed that an addition is O(1) time and a multiplication
is O(1) time as well. When working with very large integers (much greater
than +/- 2^30) it becomes false.

a + b takes log(a + b) time.

a * b takes log(a * b) time.

factorial of n takes sum(1..n,{|x| log(fact(x)) }) time.

log(fact(x)) is about x*log(x)  (???)

a sum of x*log(x) over x in 1..n takes about n**2 * log(n) if i'm
not mistaken. (???) at least it's between n**2 and n**3.

anyway, regardless of the actual result, i think you get the picture, and
we are pretty far away from straight linear time; what language you
implement it in is irrelevant.


> I cannot recall who advised to replace recursion with iteration wherever 
> possible; even though it is claimed that recursion is natural but 
> complicated recursion is not easy to grasp.

complicated recursion is difficult to grasp because it's complicated, not
because it's recursion. same goes for complicated iteration. 

also, "easy to grasp" is relative. It's not easy when there's a
significantly easier way of doing it; it is when there is not.



Mathieu Bouchard




In This Thread

Prev Next