在树形数据结构中,节点是其自身的兄弟节点吗?
我正在构建一个类似树的数据结构。 那么预期的行为是什么
public Set getSiblingNodes(Node node);
如果我有一个方法,该方法应该返回一个包含或排除自身的集合,
?谢谢!
I am building a tree like data structure. What is the expected behavior if I have a method
public Set getSiblingNodes(Node node);
Should this method return a set including or excluding itself?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
不。它应该只包含它的兄弟姐妹。
节点不是其自身的兄弟节点。
(为什么你会有不同的想法?)
No. It should contain only it's siblings.
A node is not a sibling of itself.
(Why would you think otherwise?)
一般来说没有,
但是您可以定义某种树,其中兄弟姐妹构建循环列表,然后如果该列表有一个节点,它将成为其自身的兄弟姐妹。
generally no,
But you can define some sort of tree, where siblings build the circular list and then if this list has one node it will be a sibling of itself.