Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > What is the best way to make a Tree Data Structure in one text file?

Reply
Thread Tools

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

 
 
http://links.i6networks.com
Guest
Posts: n/a
 
      08-19-2004
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?


 
Reply With Quote
 
 
 
 
John Bokma
Guest
Posts: n/a
 
      08-19-2004
"http://links.i6networks.com" <> wrote in
news:3L5Vc.832$ gers.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.


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.

--
John MexIT: http://johnbokma.com/mexit/
personal page: http://johnbokma.com/
Experienced programmer available: http://castleamber.com/
Happy Customers: http://castleamber.com/testimonials.html
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Hi, I want to implement a General Tree Data structure (Not Binary Tree ) which have more than 2 sub nodes? sharan C Programming 2 10-31-2007 02:58 AM
Hi, I want to implement a General Tree Data structure (Not Binary Tree ) which have more than 2 sub nodes? sharan C Programming 1 10-30-2007 11:01 PM
Hi, I want to implement a General Tree Data structure (Not Binary Tree ) which have more than 2 sub nodes? sharan C Programming 4 10-30-2007 08:21 PM
How to translate a C tree structure to ruby tree objects anne001 Ruby 1 02-18-2006 03:17 PM
B tree, B+ tree and B* tree Stub C Programming 3 11-12-2003 01:51 PM



Advertisments