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
ReplyDeleteNice blog.. Must say very informative With Good Pictures , We really like it. We provides
ReplyDeleteTempo traveller in Gurgaon
Tempo traveller rental Gurgaon
Hire tempo traveller Gurgaon
Luxury tempo traveller in Gurgaon
Tempo traveller on rent in Gurgaon
9 seater tempo traveller in Gurgaon
12 seater tempo traveller in Gurgaon
17 seater tempo traveller in Gurgaon
20 seater tempo traveller in Gurgaon
26 seater tempo traveller in Gurgaon
for easy travel call us +91-9560075009
Find us on Youtube: Tempo traveller on rent
Faridabad location:
FCA-1405, Block - C, SGM Nagar, Sector 48, Faridabad, Haryana 121001
Ballabgarh location:
Plot No 2 , Near Rawal International School, Faridabad, Haryana 121001
Gurgaon location: F28, 1A, DLF Phase 3, Sector 42, Gurugram, Haryana 122002
Noida location: N 1106, Sector120, Amrapali Zodiac, Noida, Uttar Pradesh 201301
Delhi location: 118, Vardhman AC Market CSC Block - E, Sec,18 Rohini, Delhi, 110089
Ghaziabad location: Flat No : 1304, Sector 16A, Sector 16, Vasundhara, Ghaziabad, Uttar Pradesh 201012