What is the best way to make a Tree Data Structure in one text file?

  • Thread starter http://links.i6networks.com
  • Start date
H

http://links.i6networks.com

I want to write a tree and read the tree from one text file by Perl's
regular expression.

What is the best way to do it in term of speed.

I want to be able to select sub note and search all note and search with a
sub note.

It is really like a Forum, but saves everything in one text file.

Here is some of my ideas:

design 1:

parentname1:childname1:childdata1
parentname1:childname2:childdata2


design2:
parentname
childname1:childdata1
childname2:childdata2

design2 saves space, but design2 also requries everything is in order.
design1 allow me just appent lines to the file.

Any other better designs?
 
J

John Bokma

I want to write a tree and read the tree from one text file by Perl's
regular expression.

What is the best way to do it in term of speed.

dump a hash of hashes to a file and read it back
I want to be able to select sub note and search all note and search
with a sub note.

In your file, or after reading the data into memory?
It is really like a Forum, but saves everything in one text file.

XML? Altough for a Forum I would recommend a database.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,968
Messages
2,570,154
Members
46,702
Latest member
LukasConde

Latest Threads

Top