title: How to create a simple unordered tree(not BST) in java with given node pairs(u,v)?
body: <p>Problem is I don't understand how to create a tree. I have gone through many code examples on trees but I don't even know how to work with/handle a node and hence I don't understand how the <strong><em>node class</em></strong> works(<em>that was present in all the program examples</em> ). When i try to use methods such as appendChild(as mentioned in java docs),I get an error,and I am asked to create one such appendChild method inside that <strong><em>node class</em></strong> within the main program. Couldn't understand why that happened.</p>
  
  <p>I am given integer pairs((u,v) meaning there is an edge between u &amp; v) of nodes and I also need to know if any Element-to-node conversion is required for using u and v(of type integer) as nodes.</p>
  
  <p>Please bear with me since my basics are weak. Little explanation on how the entire thing works/functions would be very helpful.
  Thank you.</p>
  
  <p>EDIT 1: I went through the following links:(hardly found anything on just <strong>unordered</strong> trees) <a href="http://www.cs.cmu.edu/~adamchik/15-121/lectures/Trees/code/BST.java" rel="nofollow">http://www.cs.cmu.edu/~adamchik/15-121/lectures/Trees/code/BST.java</a> <a href="http://www.newthinktank.com/2013/03/binary-tree-in-java/" rel="nofollow">http://www.newthinktank.com/2013/03/binary-tree-in-java/</a> . Tried to modify these codes to meet my own purpose but failed.
  I only got a blurry idea and that is not enough for implementation. I am trying to make a simple unordered tree,for which i am given u v pairs like:
  (4,5) (5,7) (5,6). I just need to join (4&lt;--5),(5&lt;--7) and (5&lt;--6). So how do I write a node class that only joins one node to the prev node? Besides,to do <strong>only</strong> this,do I need to bother myself with leftchild,rightchild? If not,how will I be able to traverse the tree and do similar operations such as height diameter calculation etc later? </p>
  
  <p>Thank you for your patience.</p>