A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Java in General
Binary Tree traversal
Joined: Jan 02, 2012
Jan 02, 2013 06:10:32
Hello and Happy new Year ^^
For my school assignment I built myself an AVL tree - it works as intended, however I need to represent the nodes and Data into
, But I have no idea how to do it.
Left-Data-Right representation should be 3 columns. Left subtree's Data - current Node Data - Right subtree Data
Any suggestions would be appreciated
Joined: Oct 13, 2005
Jan 02, 2013 06:43:14
Welcome to the Ranch
Do you mean an in‑order depth traversal? You don’t usually print that in columns, but the principles are easy:-
1: if left node is not null call method recursively on left node 2: print this node's value 3: if right node is not null call method recursively on right node
You can get different traversals by altering the order of parts 1 2 and 3
I agree. Here's the link:
subject: Binary Tree traversal
When do i say that a binary search tree is unique?!
Traversing the right branch of a binary tree.
Making binary tree: memory problem
How to create a File Explorer using JTree
Identify the path of the node and insert in JTree.
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2015