Skip to main content
deleted 6 characters in body
Source Link
user73941
user73941

As of GetChildrenRecursive() it seems to work, but looks rather complicated as a BFS algorithm to be. Remember that you have private access to the properties and fields of Node instances, so you can for instance call Children on any Node not just this. Below is a revised version, that is a little easier to follow:

As of GetChildrenRecursive() it seems to work, but looks rather complicated as a BFS algorithm to be. Remember that you have private access to the properties and fields of Node instances, so you can for instance call Children on any Node not just this. Below is a revised version, that is a little easier to follow:

As of GetChildrenRecursive() it seems to work, but looks rather complicated as a BFS algorithm. Remember that you have private access to the properties and fields of Node instances, so you can for instance call Children on any Node not just this. Below is a revised version, that is a little easier to follow:

added 22 characters in body
Source Link
user73941
user73941

It is safe to call Children.Remove(node) even if node is not in the list or is null, so you can omit the Contains() check. node != this - I suppose this should be avoided in the Add method - but why can't this be removed if provided as node? You could consider to return the bool values returned from Children.Remove(node), to let the client known if the operation was succesful or not.

It is safe to call Children.Remove(node) even if node is null, so you can omit the Contains() check. node != this - I suppose this should be avoided in the Add method - but why can't this be removed if provided as node? You could consider to return the bool values returned from Children.Remove(node), to let the client known if the operation was succesful or not.

It is safe to call Children.Remove(node) even if node is not in the list or is null, so you can omit the Contains() check. node != this - I suppose this should be avoided in the Add method - but why can't this be removed if provided as node? You could consider to return the bool values returned from Children.Remove(node), to let the client known if the operation was succesful or not.

deleted 1 character in body
Source Link
user73941
user73941

It is safe to call Children.Remove(node) even if node is null, so you can spareomit the Contains() check. node != this - I suppose this should be avoided in the Add method - but why can't this be removed if provided as node? You could consider to return the bool values returned from Children.Remove(node), to let the client known if the operation was succesful or not.

It is safe to call Children.Remove(node) even if node is null, so you can spare the Contains() check. node != this - I suppose this should be avoided in the Add method - but why can't this be removed if provided as node? You could consider to return the bool values returned from Children.Remove(node), to let the client known if the operation was succesful or not.

It is safe to call Children.Remove(node) even if node is null, so you can omit the Contains() check. node != this - I suppose this should be avoided in the Add method - but why can't this be removed if provided as node? You could consider to return the bool values returned from Children.Remove(node), to let the client known if the operation was succesful or not.

added 908 characters in body
Source Link
user73941
user73941
Loading
added 908 characters in body
Source Link
user73941
user73941
Loading
deleted 1 character in body
Source Link
user73941
user73941
Loading
added 1041 characters in body
Source Link
user73941
user73941
Loading
deleted 1039 characters in body
Source Link
user73941
user73941
Loading
added 41 characters in body
Source Link
user73941
user73941
Loading
Source Link
user73941
user73941
Loading