File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes Saving tree structure Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Saving tree structure" Watch "Saving tree structure" New topic

Saving tree structure

Stewart Griffin

Joined: Dec 02, 2002
Posts: 23
Hey ppl,
I'm trying to store the structure of a tree.
Any ideas on the best way of achieving this?
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Why not simply serialize the entire tree to a file? (starting from the root node)
kind regards
Ellen Zhao
Ranch Hand

Joined: Sep 17, 2002
Posts: 581
Hi Steward,
I would choose LinkedList or Vector to implement a tree data structure, generally speaking, both of them work fairly well for binary tree/binary search tree/AVL tree/fibonacci tree/b tree/b* tree(use double LinkedList here)/suffix tree/game tree etc. I don�t quite understand the "store" you mentioned here. Because usually when the tree is being generated, both its innern notes and leaves are stored in the LinkedListed or Vector. Could you please offer some further specification? I guess you wanted to visit all the notes in the tree ?

[ January 31, 2003: Message edited by: Ellen Fu ]
I agree. Here's the link:
subject: Saving tree structure
It's not a secret anymore!