Re: iterative copying of binary expression trees



It is iterative and functional, I pass the stack as an argument.
push and pop are *not* destructive. See the last reply from pjb...

Thanks Pascal, I'll get an eye on your lap-level solution :-)

JG

In article
<a868c224-0358-42ee-a58f-0349999d702d@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>,
gugamilare <gugamilare@xxxxxxxxx> wrote:

On 23 maio, 12:01, Jean Guillaume Pyraksos <wis...@xxxxxxxxxxx> wrote:
None, I do *want* a tail-recursive, purely functional, first order solution.
I'll try myself, or prove me that this is impossible.
I have already such a tail-recursive, purely functional, first order solution
in O(n) but two-phase, in 2n iterative steps.
I'm looking for a one-phase solution. I don't see on the theoretical side why
I couldn't find one.

But are you sure that the first phase of your algorithm is iterative
and purely functional? You said you push the left son into a stack,
and this is not exactly functional (you need to use "pop", which is
destructive). You can do the exact same thing to create your algorithm.
.



Relevant Pages

  • Re: Is it wise to push all-in early in a tournament?
    ... The best times to make a push play ... But why call when you can push and take down a nice pot when your opponent ... But remember that if this "big bet" is a significant portion of your stack, ... I consider it my goal in any tournament to do the latter as much as ...
    (rec.gambling.poker)
  • Re: Is it wise to push all-in early in a tournament?
    ... whether or not the rest of the table is splashing chips around. ... I may push more than I want to and you may be more conservative than ... Do I want to play this opponent after the flop? ... push at anytime and I may not want to risk my stack on a suckout when I ...
    (rec.gambling.poker)
  • Re: hacker challenge - traverse a list
    ... that stack to a long integer and packing its values, ... Your algorithm, in abstract, is either bounded (and thus does not solve ... "Platonism" has a precise meaning. ... The problem here is that thugs think they can discount intentions. ...
    (comp.programming)
  • Virtual machine: assembly instructions
    ... push; Push the address of the first variable onto the stack ... itof: convert integer to float ... If top+1 of int stack is less than top; push true else push false ...
    (comp.programming)
  • Re: hard disk faster than main memory?
    ... > sophisticated numerical algorithm working on stacks. ... For sometimes our stack size ... > writing everything to hard disk is faster than the stack implementation ... A random I/O operation to disk is usually ...
    (comp.programming)

Loading