Re: Non-recursive chop and clone for Binary Search Tree - Solutions
- From: free@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx (*** Wesseling)
- Date: 24 Nov 2007 05:07:21 GMT
In article <9eb91415-ef51-4fb2-a734-b894fa88c573@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>,
"jehugaleahsa@xxxxxxxxx" <jehugaleahsa@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.
Why? Stack/resursion depth is bounded by the height of the tree. A
decent BST will use some form of balancing, which should keep the height
down to a few dozen levels or so.
.
- References:
- Non-recursive chop and clone for Binary Search Tree - Solutions
- From: jehugaleahsa@xxxxxxxxx
- Non-recursive chop and clone for Binary Search Tree - Solutions
- Prev by Date: Re: Non-recursive chop and clone for Binary Search Tree - Solutions
- Next by Date: Re: Non-recursive chop and clone for Binary Search Tree - Solutions
- Previous by thread: Re: Non-recursive chop and clone for Binary Search Tree - Solutions
- Next by thread: Re: Non-recursive chop and clone for Binary Search Tree - Solutions
- Index(es):