For the below tree,
typedef struct SiblingTreeNode{
void *item;
struct SiblingTreeNode *parent;
struct SiblingTreeNode *firstChild;
struct SiblingTreeNode *nextSibling;
}SibTreeNode;
typedef struct Tree{
SibTreeNode *root;
int size; // number of nodes in tree
}Tree;
1)
Assuming the huge depth of a tree, To avoid stack overflow, Can we perform DFS without using recursion?
2)
Generally, a tree node has n child pointers and data pointer(item
), From performance aspect of operations on tree, What are the advantages of maintaining sibling(nextSibling
) and first child(firstChild
) and parent pointer(parent
)?