The lost art (Was: The VAX is running
Charles H Dickman
chd_1 at nktelco.net
Mon Apr 6 17:18:29 CDT 2009
Chris Kennedy wrote:
> John Floren wrote:
>
>
>> I hope the answer is recursion. The answer should ALWAYS be recursion,
>> right Professor McCarthy? :)
>>
>
> Only if you have an arbitrary amount of memory available. What if
> you're constrained to a handful of automatics?
>
>
Two extra pointers... run down the list saving the previous node until
you get to the end. Print the last node. Run down until you get to the
previous node of the last run down the list and print it. Repeat the
previous sentence until you have printed the first node. No copying,
very little extra storage, but you exchange that for long runtime.
I'm a CE, not a programmer, so this is probably wrong.
-chuck
More information about the cctalk
mailing list