开发者

In a tree data structure, is a node a sibling of itself?

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!


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜