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

Discussion in 'Perl Misc' started by http://links.i6networks.com, Aug 19, 2004.

  1. 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?
     
    http://links.i6networks.com, Aug 19, 2004
    #1
    1. Advertising

  2. http://links.i6networks.com

    John Bokma Guest

    "http://links.i6networks.com" <> wrote in
    news:3L5Vc.832$:

    > 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
     
    John Bokma, Aug 19, 2004
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Stub

    B tree, B+ tree and B* tree

    Stub, Nov 12, 2003, in forum: C Programming
    Replies:
    3
    Views:
    10,234
  2. sharan
    Replies:
    4
    Views:
    719
    CBFalconer
    Oct 30, 2007
  3. sharan
    Replies:
    2
    Views:
    864
    SM Ryan
    Oct 31, 2007
  4. sharan
    Replies:
    1
    Views:
    713
    CBFalconer
    Oct 30, 2007
  5. anne001
    Replies:
    1
    Views:
    253
Loading...

Share This Page