Which structure/class should I use?

Login to reply to this topic.
Thu, 2007-01-04 12:16
Joined: 2005-11-16
Forum posts: 63
Hi,

A text file is given which contains the following lines of text:

Root|NodeA|Foo
Root|NodeB|Bar
Root|NodeB|Baz

Now I want to put the strings into descriptors and put these into a
hierachical (tree/map whatever) structure.

     Root
  /         \   
NodeA   NodeB
|          |      \
Foo       Bar    Baz

I don't want to use an XML class or something with such an overhead.
Can somebody suggest an appropritate Symbian-class for that problem.
An example algorithm for transfering the file content into that
structure would be great.

regards
Martin

Thu, 2007-01-04 13:18
Forum Nokia Champion
Joined: 2004-05-26
Forum posts: 732
Re: Which structure/class should I use?
Thu, 2007-01-04 16:28
Joined: 2006-08-02
Forum posts: 24
Re: Which structure/class should I use?
Can u elobrate on what exatly ur are trying to do.Before that i have 1 question i.e
[1] What sort of tree are u creating Binary, B+ ,general.If it is a Binary Tree then u can look at the DBMS Example and store the left and the right values.This is Called as Persistent Storeage and the link above(given by the previous user is quite exhaustive)

U can use the select clause to traverse trgh the records.Typically this is how ur Fields should look


+---------------------------------------------------+
|NodeName |Left Element| Right Element  |
------------------------------------------------------

If u can elobarate a bit more i can give u the source code

Symbian Develpoer

Thu, 2007-01-04 20:20
Joined: 2005-11-16
Forum posts: 63
Re: Which structure/class should I use?
Thanks for your reply.

What I want to do is to put the given text strings "Root|NodeA|SubNodeA| ... |Leaf" into a structure which I can easily traverse (dont know if this is the correct term).

So a node can have more than two children -  I dont know which kind of tree fits best here.

Martin
Fri, 2007-01-05 13:15
Joined: 2003-12-05
Forum posts: 683
Re: Which structure/class should I use?
Check out Developer Library » API Reference » C++ API reference » B-Trees in the dev docs, or alternatively, check out the Composite design pattern.
  • Login to reply to this topic.