It is tree structure with parent and sibling hierarchy:
struct node
{
node* first_sibling;
node* first_child;
// other data (like it is file or folder, etc)
};
For tree:
root
app
test1
test2
src
frm
usr1
usr2
usr3
root will be first allocated node struct.
root->first_sibling will point to first node at same level (so it will be
NULL), root->first_child will point to 'app'. app node (let say anode)
will be like: anode->first_sibling point to src, anode->first_child point
to test1, and so ...
Most operation will be recursive:
void dump(node* n)
{
dump(n->first_sibling);
dump(n->first_child);
}
|