Mail Archives: djgpp/1999/04/26/15:05:26.1
In article <37213049 DOT 1471831 AT news-server>, -Gadget-nospam-
@vic.bigpond.net.au says...
> A linked list is an iterative structure, not a recursive one.
> A tree structure is recursive.
You've never programmed in LISP, have you?
The typical C++ definition of a linked list is something like
struct node
{
type value;
node *next;
};
If that's not a recursive definition, I don't know what is.
In fact it is _also_ an iterative structure, because iteration and tail-
recursion are functionally equivalent.
> As was mentioned earlier, this makes an interesting stunt (stunt?!),
> but is a bit like peeling oranges with a potato peeler. There are much
> better and more efficient ways, so why make life difficult.
> You wouldn't rewrite the code 'for (n=0 ; n<100; n++)' as a recursive
> routine... or would you?
Only if I was rewriting it in LISP, or some other functional language.
C++ generally handles iteration more efficiently than recursion (I think
I mentioned that before).
Seth Jones
- Raw text -