i have table like
ChildNode ParentNode LorR
1 NULL NULL
2 1 0
3 1 1
4 2 0
5 2 1
6 3 0
7 3 1
8 4 0
9 4 1
10 5 0
11 6 0
12 7 1
this table data define Binary Tree Data
first node is 1
LorR define child is ini left(0) or Right(1)
1 st node has two child node 2 and 3 in Left and Right
2 nd node has two child node 4 and 5 in Left and Right
3 rd node has two child node 6 and 7 in Left and Right
4 th node has two child node 8 and 9 in Left and Right
5 th node has one child node 10 in Left
6 th node has one child node 11 in Left
7 th node has one child node 12 in Right
now if i want to find the number of total child nodes of any parent node
for ex...node 2 (parent) has a 4 child (4,5,8,9)
node 6 (parent) has a 1 child (11)
node 3 (parent) has a 4 child (6,7,11,12)
then As a parameter Parent node how can i get the number of Child and subchild nodes
also how can i find total number of Left Child's subchild nodes...
please help....