in reply to Find opcode's reverse sibling?
Can you elaborate please Diotalevi. Some modern tree math terminology (badly) refers to 'siblings' and 'children'
the same. You want to find to all nodes that share the same parent? That is what siblings are. If so the method you have, traverse to the parent and enumerate all children is optimal. In a B-Tree there will only be 2 possible children, so just the fact of having more than one link tells you a sibling exists. Node depth alone is not enough, it could be the evil twin on the other side of the tree.
Re^2: Find opcode's reverse sibling?
by diotalevi (Canon) on Jun 13, 2004 at 12:10 UTC
|
You're on the wrong track. These terms are specific to perl's internal representation of compiled perl code. Here, children and siblings are separete things - siblings is a ordered, linked list of nodes that are children to a parent node. The linked list is constituted by a op_sibling pointer, the parent points to the first sibling with op_first, the last sibling with op_last and none of the middle ones. Sibling nodes do not point at any other sibling nodes except with the previously described op_sibling pointer. This is all about perl guts.
| [reply] |
|