In the below tree,typedef struct lcrsNode{   void *item;   struct lcrsNode *parent;   struct lcrsNode *firstChild;   struct lcrsNode *nextSibling;  }lcrsNode;typedef struct Tree{   lcrsNode *root;   int size; // Number of nodes;}Tree;What are the advantages of maintaining parent pointer in a tree node? Does it help in performing DFS without recursion or explicit stack?
Advantage of maintaining parent pointer - LCRS tree
c;data structures;trees
DFS or Depth First Search is a form of tree traversal DFS means you descend the children as far as you can then climb back up to the parent to do it again (see dotted line).  That's hard to do if the node doesn't point to the parent.  If it doesn't you have to somehow remember where the parent is, with say, recursion or an explicit stack.  If the node knows its parent then simple iteration is enough to implement a DFS. If this is for a homework assignment remember your instructor can search and find this as easily as you can.  Show you can think about this for yourself.