views:

172

answers:

1

I am planning to implement a tree structure where every node has two children and a parent along with various other node properties (and I'd want to do this in Java )

Now, the way to it probably is to create the node such that it links to other nodes ( linked list trick ), but I was wondering if there is any good external library to handle all this low level stuff. ( for eg. the ease of stl::vector vs array in C++ ).

I've heard of JDots, but still since i haven't started (and haven't programmed a lot in Java), I'd rather hear out before I begin.

A: 

If you haven't programmed a lot in Java yet, implementing a tree structure yourself might be a good practice. It is really quickly done (at least what I can read from your description) and using a library for that might just overcomplicate things (you have to learn the API first and then sort out the things you actually need etc.). If you use a generic class you can even reuse it

class Node<T>
{
    private Node left;
    private Node right;
    private T data;

    // Getters and setters
}
Daff