Re: Non-recursive chop and clone for Binary Search Tree - Solutions



"jehugaleahsa@xxxxxxxxx" <jehugaleahsa@xxxxxxxxx> writes:

On Nov 23, 6:14 pm, Ben Pfaff <b...@xxxxxxxxxxxxxxx> wrote:
"jehugalea...@xxxxxxxxx" <jehugalea...@xxxxxxxxx> writes:
At the time, I wasn't in the mood; however, I was recently REQUIRED to
figure it out. The problem: I had an unbalanced tree that needed
destroyed. You can usually get away with a recursive (naive/trivial)
implementation, but you're leaving yourself open for a stack overflow
at some point down the line.

There's no need to use level order for that. I would do it like
this:http://adtinfo.org/libavl.html/Destroying-a-BST-by-Rotation.html

Right . . . it does everything on the way down using a form of stack.

No. No stack is involved. It's a simple iterative loop.
--
Ben Pfaff
http://benpfaff.org
.



Relevant Pages

  • Re: Bubble SNG play - Correct?
    ... Fourth - If the big stack busts us both I still get 3rd ... When you fold, 75% of the time you can expect shorty to bust, leaving you ... an equity of $265.90. ...
    (rec.gambling.poker)
  • Re: Bubble SNG play - Correct?
    ... Third - If the all in shorty doesnt have a pocket pair then the 4 cards ... Fourth - If the big stack busts us both I still get 3rd ... When you fold, 75% of the time you can expect shorty to bust, leaving you ... an equity of $265.90. ...
    (rec.gambling.poker)
  • Re: Bubble SNG play - Correct?
    ... Fourth - If the big stack busts us both I still get 3rd ... When you fold, 75% of the time you can expect shorty to bust, leaving you ... an equity of $265.90. ...
    (rec.gambling.poker)
  • Re: Bubble SNG play - Correct?
    ... Third - If the all in shorty doesnt have a pocket pair then the 4 cards ... Fourth - If the big stack busts us both I still get 3rd ... When you fold, 75% of the time you can expect shorty to bust, leaving you ... an equity of $265.90. ...
    (rec.gambling.poker)
  • Re: Bubble SNG play - Correct?
    ... Fourth - If the big stack busts us both I still get 3rd ... When you fold, 75% of the time you can expect shorty to bust, leaving you ... an equity of $265.90. ...
    (rec.gambling.poker)