Comments on: Programming – The art of giving percise instructions http://v1.ripper234.com/p/programming-the-art-of-giving-percise-instructions/ Stuff Ron Gross Finds Interesting Sun, 02 Aug 2015 11:03:35 +0000 hourly 1 https://wordpress.org/?v=4.5.3 By: Friend http://v1.ripper234.com/p/programming-the-art-of-giving-percise-instructions/comment-page-1/#comment-1169 Sat, 31 Jan 2009 09:17:16 +0000 http://v1.ripper234.com/?p=889#comment-1169 This is not the most efficient way, because you don’t need to calculate (X+Y)! at all. Note that the biggest number will be at most (2X)!/(X!)^{2}, (by setting X=Y). So there is no need to calculate the number (X+Y)! to its bitter end. Probably the most efficient way to calculate this asymptotically, is by using Stirling’s formula. Note that by the nature of this approximation, it is evident that the complexity is way beyond exponential. It is in fact something like X^{X}.

]]>
By: A Quantum Immortal » Blog Archive » Never rely on tail recursion elimination http://v1.ripper234.com/p/programming-the-art-of-giving-percise-instructions/comment-page-1/#comment-1120 Thu, 29 Jan 2009 12:31:02 +0000 http://v1.ripper234.com/?p=889#comment-1120 […] previously posted a recursive implementation of Factorial, and asked the readers “not to bother saying it’s inefficient because of recursion, […]

]]>
By: ripper234 http://v1.ripper234.com/p/programming-the-art-of-giving-percise-instructions/comment-page-1/#comment-851 Sat, 17 Jan 2009 08:07:23 +0000 http://v1.ripper234.com/?p=889#comment-851 You’re not alone in this confusion. There is one route from the origin to itself – the empty route.

It’s basically a matter of definition, but my definition allows us to have no special cases in the 3rd solution.

]]>
By: Boaz http://v1.ripper234.com/p/programming-the-art-of-giving-percise-instructions/comment-page-1/#comment-850 Sat, 17 Jan 2009 07:56:02 +0000 http://v1.ripper234.com/?p=889#comment-850 Yes, I’m stupid.
Though the fact that if x = 0 and y = 0 you return 1 confused me.

]]>
By: ripper234 http://v1.ripper234.com/p/programming-the-art-of-giving-percise-instructions/comment-page-1/#comment-849 Sat, 17 Jan 2009 07:45:17 +0000 http://v1.ripper234.com/?p=889#comment-849 Thanks Eli.

Boaz, you are incorrect. If x == 0, this means you have no more Left moves left. You have only one route to get to the origin, by going Down all the time. Remember, we are calculating the number of routes to get to the origin, not the length of the route.

]]>
By: Boaz http://v1.ripper234.com/p/programming-the-art-of-giving-percise-instructions/comment-page-1/#comment-848 Sat, 17 Jan 2009 07:04:26 +0000 http://v1.ripper234.com/?p=889#comment-848 Why “return 1”?
I believe it should be:
if (x == 0) return y;
if (y == 0) return x;

]]>
By: Eli http://v1.ripper234.com/p/programming-the-art-of-giving-percise-instructions/comment-page-1/#comment-847 Sat, 17 Jan 2009 06:25:03 +0000 http://v1.ripper234.com/?p=889#comment-847 Nice post!

]]>