I tried my best to find specific node in first child node sibling structure but I am not able to do this any one who can help or give me method to find node method.
I can write add method but I'm not able to write method.
My code:
public int Weight { get; private set; }
public string Data { get; private set; }
public int NodeIndex { get; private set; }
public TreeNode FirstChild { get; private set; }
public TreeNode NextSibling { get; private set; }
public TreeNode ParentNode { get; private set; }
TreeNode Root, Head;
public TreeNode()
{
}
public TreeNode(int Weight, TreeNode firstChild, TreeNode nextSibling, string Data, int NodeIndex)
{
this.Durability = Durability;
this.Weight = Weight;
this.Data = Data;
this.FirstChild = firstChild;
this.NextSibling = nextSibling;
this.NodeIndex = NodeIndex;
}
Assume that I have created tree in following structure every one has unique NodeIndex so how can I find this node?
Thanks in advance.
Here's my structure:
Root
|
p1 ----- p2 ----- p4 ----- p6
| | | |
c1 p3 c4 p7
| |
c2 - c3 c5