Here I will show how to count the number of left right node of a parent node or some node.
Here I am sueing MS. SQL Database and structure is some thing like this.
-------------------------------------------------------
Id(int) | Parent_Id (int) | Placement (NVarChar(10))
-------------------------------------------------------
1 0 -
2 1 Left
3 1 Right
4 2 Left
5 2 Right
-------------------------------------------------------
Here I am using double recursion to find the count of left & right node.
It will return your left & right count in the variable Cl and Cr.
Try yours.
Here I am sueing MS. SQL Database and structure is some thing like this.
-------------------------------------------------------
Id(int) | Parent_Id (int) | Placement (NVarChar(10))
-------------------------------------------------------
1 0 -
2 1 Left
3 1 Right
4 2 Left
5 2 Right
-------------------------------------------------------
Here I am using double recursion to find the count of left & right node.
Code:
It will return your left & right count in the variable Cl and Cr.
Try yours.
The name 'obj' does not exist in the current context
ReplyDeleteThe name 'Cr' does not exist in the current context
Generating flowing errors
Unable to find DATA class..
ReplyDeletePlease, can these code be translated in PHP MYSQL.
ReplyDeleteSir jee Wll you give me source code of above code
ReplyDelete