Re: Binary tree

From: Thomas Weidenfeller (nobody_at_ericsson.invalid)
Date: 02/22/05


Date: Tue, 22 Feb 2005 12:28:28 +0100

Laurent Guichard wrote:
> Hello,
> I'd like to display a binary tree (each node has two children). I try to use
> the JTree class but the problem is that the children of a node are always
> below this node... which is not the normal representation of a binary tree
> (one child above and one child below).
> Would you have any ideas ?

The FAQ has a very vague description about how to draw trees (because it
is common homework). You can find sufficient details and algorithms in
basically any introductionary textbook to computer graphics or
algorithms and data structures.

/Thomas

-- 
The comp.lang.java.gui FAQ:
ftp://ftp.cs.uu.nl/pub/NEWS.ANSWERS/computer-lang/java/gui/faq


Relevant Pages

  • Re: how to walk a binary tree
    ... > I have a question about how to walk a binary tree. ... If the current node prints into slot, the left child prints into 2*slot+1, ... but I don't know how a queue can help. ... If you have to use depth first search for some reason, you can use priority ...
    (comp.lang.cpp)
  • Re: walking a binary tree
    ... > I have a question about how to walk a binary tree. ... > node is at and whether it's a left or right child. ... but I don't know how a queue can help. ... if non empty root add the root to the q ...
    (comp.lang.c)
  • Re: recursion.
    ... right child. ... IF I was making a recursive program for binary tree, ... you should ask "what is the recursive algorithm for ...
    (comp.lang.c)
  • Re: Would it matter if ZF was inconsistent?
    ... reasons, cannot be larger than that of nodes. ... be either a left child or a right child, ... In my game "conquer the binary tree", node number 1 may correspond to ... Which path in WM's alleged list of paths corresponds to Cantor's ...
    (sci.logic)
  • Re: Depth First Search traversal of this list
    ... ??>> It looks like I represented the binary tree incorrectly in the list- ... this makes more sense, but if you mark leaf nodes as singleton lists, this ... left child and right child. ... your algorithm in terms of node-name, left-child and right-child. ...
    (comp.lang.lisp)