I have these instance methods in my Java implementation of Binary Tree and Search Binary Tree: getSize()
, getHeight()
, getDepth()
, getPreOrder()
, getInOrder()
, getPostOrder()
and getLevelOrder()
. These methods use the root of the tree in others recursive methods that have a parameter Node
. Which is more appropiate to use from the point of view of the OOP:
- Using these recursive methods as static methods, because they use an object (
Node
) that doesn't belong to the actual class, and they don't use any class attributes, - They can be instance methods because they can use in a subtree of this tree and they don't use any static attributes,
- or they may be in other static class like
UtilsTree()
?