Re: A puzzle
Re: A puzzle
- Subject: Re: A puzzle
- From: "Mark J. Reed" <email@hidden>
- Date: Fri, 21 Nov 2008 22:16:16 -0500
Sorry, I get the confusion. The C code is an exception to the "same
algorithm" bit; I overstated that aspect. I only uised the
spit-string-on-1's technique where it didn't require implementing the
basic split-string-on-a-delimiter functionality from scratch. :)
On 11/21/08, Mark J. Reed <email@hidden> wrote:
> On Fri, Nov 21, 2008 at 9:31 PM, Philip Aker <email@hidden> wrote:
>
>> Also, is the C code dynamically allocating storage for the result or is
>> it
>> using a pre-defined size?
>
>
> Allocating storage? The C code is using nothing but integers.
>
> #include <stdio.h>
> int main(int argc, char *argv[])
> {
> int total=0;
> int i;
> for (i=0; i<1000000; ++i)
> {
> int j;
> for (j=i; j; j/=10)
> if (1 == j) total++;
> }
> printf("%d\n", total);
> return 0;
> }
>
>
>
> --
> Mark J. Reed <email@hidden>
>
--
Sent from Gmail for mobile | mobile.google.com
Mark J. Reed <email@hidden>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden