2

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!

4

2 に答える 2

3

No. It should contain only it's siblings.
A node is not a sibling of itself.
(Why would you think otherwise?)

于 2010-10-16T18:09:35.160 に答える
0

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.

于 2016-05-12T10:28:53.227 に答える