Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
The Java EE 7 Tutorial Volume 1 or Volume 2
this week in the
jQuery UI in Action
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
Did you see how Paul
cut 87% off of his electric heat bill with 82 watts of micro heaters
subject: Binary Tree traversal
Traversing the right branch of a binary tree.
Identify the path of the node and insert in JTree.
When do i say that a binary search tree is unique?!
How to create a File Explorer using JTree
Making binary tree: memory problem
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014