TIP: Click on subject to list as thread! ANSI
echo: c_plusplus
to: SOREN PETERSEN
from: DON GUY
date: 1997-05-20 22:39:00
subject: Binary Search Tree

.286p
.model small
name Replying_To_A_Message_from_Soren
assume CS:ReplyBody
ReplyBody segment byte public
Soren:
 #SP#> How to insert something in the tree and still be sure that the tree is
 #SP#> very compact (to enable the fastest search capabilities)
By compact do you mean balanced?
It could certainly be done, though I think you would be wasting your time. In 
a worst case scenario, you'd have to re-balance the tree after the addition 
of any new node. I expect that the time consumed by the process of 
re-balancing, would effectively negate any advantage which you might gain 
from searching through a balanced BST as opposed to a BST in its "natural" 
state.
 #SP#> How to delete a node in the tree.
Very carefully. ;-)
Find the node you wish to delete. If it happens to be a leaf node, you're in 
luck, and all you have to do is delete it.
If it is not a leaf node, removing it will result in the creation of either 
two or three smaller trees. Now pick one tree, and find the appropriate leaf 
at which to attach the other orphaned tree(s) (use the same method you would 
to add a node to the tree).
 mov ax,4C00h
 int 21h
Reply ends
end Soren
... Mary had a little RAM -- only about a MEG or so.
---
---------------
* Origin: Extreme Impossibility/2 [Kingston, Ontario, Canada] (1:249/176)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.