ancestor node(祖先节点):在树(tree)或层级结构中,位于某个节点之上、并且从根节点到该节点路径上出现的任何节点(通常不包括该节点自身)。常见于计算机科学中的树结构、DOM、文件系统等语境。(也常说 an ancestor of a node。)
/ˈæn.ses.tɚ noʊd/
An ancestor node of this folder is the root directory.
这个文件夹的一个祖先节点是根目录。
In a binary tree, checking whether one node is an ancestor node of another helps determine their relationship and is useful for problems like finding the lowest common ancestor.
在二叉树中,判断一个节点是否为另一个节点的祖先节点有助于确定它们的关系,并常用于求“最近公共祖先”等问题。
ancestor 源自拉丁语 antecessor,意为“走在前面的人、前辈”,由 *ante-*(在前)+ cedere(行走)构成;node 源自拉丁语 nodus,意为“结、节点”。组合成 ancestor node 后,语义直观地表示“在层级/路径上更靠前的节点”。