Reputation: 3460
I have some code where the user can delete one child record of a parent record one at a time. I'm detecting when there are no children left. At that point, I'm deleting the parent record as well. When coming up with a name for the variable, I realized I don't know what you call a parent with no children.
Is there a single, accepted name that I haven't heard of (or can't remember)?
Upvotes: 3
Views: 4820
Reputation: 3885
Leaf: (no children)
Terminal: (never children)
Vacant: (had children)
Orphan: (no parent)
Leaf seems pretty standard according to wikipedia. "Terminal Node" on wikipedia will re-direct you to leaf node.
Your orphanage had a child. The child got adopted and left. Your orpahage is now vacant.
Example in OpenGL:
An EBO references a VAO. A VAO references a VBO. A VBO is raw data and references nothing else.
( EBO --> VAO --> VBO )
Thinking of the VBO as a "terminal node" would make more sense than thinking of it as a leaf. Because it will not and cannot have children.
Upvotes: 4
Reputation: 15148
There are two common computer science notions of parent: relative/transitive and absolute/non-transitive. One node can be the parent of another (a child). (Hence, object of a transitive "is" or "parents"). A node with no children is a leaf node; a node with children is a parent node. (Hence, object of a non-transitive "is"). Neither of these involve the non-instantaneous notion of ever once having had children, eg as in the real world.
Each node of the type you are describing is during processing (before and after pruning) both a parent and not a parent. So you are using something like the non-instantaneous/real-world third meaning, something like "was a parent but isn't any more". (Think about what you're saying: it's a parent in the sense that it used to be a parent node even though it's not a parent node. So it's a parent ...because... it's not a parent.)
Once it's going to be deleted, how about NoLongerParent? But if you're just using a name for that node for all the processing, and it starts as a non-leaf, why not just Parent?
Upvotes: 1