In fact I was about to say that currently the tree is only a binary tree. I
think we should have tree as generic tree (supporting n-ary operations)and
derive binary tree from it.

Also Node should be a generic node and derive a TreeNode from it. As you
can see we can reuse Node as container when placing it inside a linked
list. Also we can implement nextSibling(), previousSibling(),
firstAncestor(), lastAncestor() etc on a TreeNode. Whereas we can implement
firstChild(), lastChild() etc for the Tree.
On Nov 17, 2013 8:26 AM, "Amogh Bihani" <notifications@github.com> wrote:

> In src/utils/node.h:
>
> > +namespace utils {
> > +
> > +template <class T>
> > +class Node {
> > +public:
> > +    Node();
> > +    Node(T val);
> > +    void setValue(const T val);
> > +    void setParent(Node* parent);
> > +    T value() const;
> > +    Node* parent() const;
> > +    int children();
> > +    void addChildToLeft(Node* child);
> > +    void addChildToRight(Node* child);
> > +    void addChildAtPosition(int pos, Node* child);
> > +    Node* getChildAt(int pos) const;
>
> Then how would we access them... if it is a binary tree, we can use left
> and right but what if we have more than 2 children?
> … <#14263fcb24e76891_>
> On 17 Nov 2013 08:23, "Vivek Galatage" <notifications@github.com> wrote:
> In src/utils/node.h: > +namespace utils { > + > +template <class T> >
> +class Node { > +public: > + Node(); > + Node(T val); > + void
> setValue(const T val); > + void setParent(Node* parent); > + T value()
> const; > + Node* parent() const; > + int children(); > + void
> addChildToLeft(Node* child); > + void addChildToRight(Node* child); > +
> void addChildAtPosition(int pos, Node* child); > + Node* getChildAt(int
> pos) const; Specifying index position might be confusing about how one
> would index them. We would not use this one. — Reply to this email directly
> or view it on GitHub<
> https://github.com/vivekgalatage/DSLibrary/pull/12/files#r7711417> .
>
> —
> Reply to this email directly or view it on GitHub<https://github.com/vivekgalatage/DSLibrary/pull/12/files#r7711423>
> .
>